Merge pull request #363 from vkuznet/fix-wma-producer #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.20 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
# - name: Get dependencies | |
# run: | | |
# go get github.com/google/uuid | |
# go get github.com/vkuznet/lb-stomp | |
# go get github.com/lestrrat-go/file-rotatelogs | |
# go get github.com/nats-io/nats.go | |
- name: Build | |
run: | | |
cd src/go | |
make | |
cd - | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload linux binary | |
id: upload-wmarchive | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./src/go/wmarchive | |
asset_name: wmarchive | |
asset_content_type: application/octet-stream | |
- name: Get the Ref | |
id: get-ref | |
uses: ankitvgupta/ref-to-tag-action@master | |
with: | |
ref: ${{ github.ref }} | |
head_ref: ${{ github.head_ref }} | |
- name: Build image | |
run: | | |
curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/wmarchive/Dockerfile | |
curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/wmarchive/run.sh | |
curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/wmarchive/wmarch_go.json | |
sed -i -e "s,ENV TAG=.*,ENV TAG=${{steps.get-ref.outputs.tag}},g" Dockerfile | |
cat Dockerfile | |
chmod +x run.sh | |
docker build . --tag docker.pkg.github.com/dmwm/wmarchive/wmarchive | |
docker tag docker.pkg.github.com/dmwm/wmarchive/wmarchive registry.cern.ch/cmsweb/wmarchive | |
- name: Login to registry.cern.ch | |
uses: docker/[email protected] | |
with: | |
registry: registry.cern.ch | |
username: ${{ secrets.CERN_LOGIN }} | |
password: ${{ secrets.CERN_TOKEN }} | |
- name: Publish image to registry.cern.ch | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.CERN_LOGIN }} | |
password: ${{ secrets.CERN_TOKEN }} | |
registry: registry.cern.ch | |
repository: cmsweb/wmarchive | |
tag_with_ref: true | |
- name: Login to docker github registry | |
uses: docker/[email protected] | |
with: | |
registry: docker.pkg.github.com | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Registry | |
uses: docker/[email protected] | |
with: | |
registry: docker.pkg.github.com | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
load: true | |
tags: cmssw/wmarchive:${{steps.get-ref.outputs.tag}} | |
- run: docker push cmssw/wmarchive:${{steps.get-ref.outputs.tag}} | |
- name: Push new image to k8s | |
run: | | |
curl -ksLO https://raw.githubusercontent.com/vkuznet/imagebot/main/imagebot.sh | |
sed -i -e "s,COMMIT,${{github.sha}},g" -e "s,REPOSITORY,${{github.repository}},g" -e "s,NAMESPACE,wma,g" -e "s,TAG,${{steps.get-ref.outputs.tag}},g" -e "s,IMAGE,registry.cern.ch/cmsweb/wmarchive,g" -e "s,SERVICE,wmarchive,g" -e "s,HOST,${{secrets.IMAGEBOT_URL}},g" imagebot.sh | |
chmod +x imagebot.sh | |
cat imagebot.sh | |
sh ./imagebot.sh |