v00.06.47rc3 #533
Workflow file for this run
This file contains hidden or 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 | |
| env: | |
| tag_regex_st: '^v?[0-9]+\.[0-9]+\.[0-9]+$' | |
| tag_regex_rc: '^v?[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$' | |
| on: | |
| push: | |
| tags: | |
| - 'v?[0-9]+.[0-9]+.[0-9]+' | |
| - 'v?[0-9]+.[0-9]+.[0-9]+rc[0-9]+' | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get the Ref | |
| id: get-ref | |
| uses: ankitvgupta/ref-to-tag-action@master | |
| with: | |
| ref: ${{ github.ref }} | |
| head_ref: ${{ github.head_ref }} | |
| - name: Set Release Flags | |
| id: rel-flags | |
| run: | | |
| echo "is-stable=false" >> $GITHUB_OUTPUT | |
| echo "is-rc=false" >> $GITHUB_OUTPUT | |
| if [[ ${{ steps.get-ref.outputs.tag }} =~ ${{ env.tag_regex_st }} ]]; then | |
| echo "is-stable=true" >> $GITHUB_OUTPUT | |
| echo "Build triggered on stable release" | |
| elif [[ ${{ steps.get-ref.outputs.tag }} =~ ${{ env.tag_regex_rc }} ]]; then | |
| echo "is-rc=true" >> $GITHUB_OUTPUT | |
| echo "Build triggered on release candidate" | |
| fi | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: ^1.17 | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v2 | |
| - name: Build | |
| env: | |
| GOPATH: /home/runner/go | |
| run: | | |
| ${{ steps.rel-flags.outputs.is-rc }} && echo "Building a release candidate ..." || true | |
| ${{ steps.rel-flags.outputs.is-stable }} && echo "Building a stable release ..." || true | |
| sed -i -e "s,_ \"github.com/mattn/go-oci8\",,g" web/server.go | |
| sed -i -e "s,_ \"gopkg.in/rana/ora.v4\",,g" web/server.go | |
| mkdir -p $GOPATH/src/github.com/vkuznet | |
| cp -r ../dbs2go $GOPATH/src/github.com/vkuznet | |
| make | |
| - name: Create Release | |
| id: create_release | |
| if: fromJSON(steps.rel-flags.outputs.is-stable) | |
| 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: Create PreRelease | |
| id: create_prerelease | |
| if: fromJSON(steps.rel-flags.outputs.is-rc) | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| draft: false | |
| prerelease: true | |
| - name: Upload binaries | |
| id: upload-dbs2go | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ fromJSON(steps.rel-flags.outputs.is-stable) && steps.create_release.outputs.upload_url || steps.create_prerelease.outputs.upload_url }} | |
| asset_path: ./dbs2go | |
| asset_name: dbs2go | |
| asset_content_type: application/octet-stream | |
| - name: Build image | |
| run: | | |
| curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/dbs2go/Dockerfile | |
| curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/dbs2go/oci8.pc | |
| curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/dbs2go/config.json | |
| curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/dbs2go/monitor.sh | |
| curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/dbs2go/run.sh | |
| chmod +x run.sh | |
| sed -i -e "s,ENV TAG=.*,ENV TAG=${{steps.get-ref.outputs.tag}},g" Dockerfile | |
| docker build . --tag docker.pkg.github.com/vkuznet/dbs2go/dbs2go | |
| docker tag docker.pkg.github.com/vkuznet/dbs2go/dbs2go registry.cern.ch/cmsweb/dbs2go | |
| - name: Login to registry.cern.ch | |
| uses: docker/login-action@v1.6.0 | |
| 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/dbs2go | |
| tag_with_ref: true | |
| tags: ${{ fromJSON(steps.rel-flags.outputs.is-stable) && format('{0}, {0}-stable', steps.get-ref.outputs.tag) || steps.get-ref.outputs.tag }} | |
| # - name: Login to docker github registry | |
| # uses: docker/login-action@v1.6.0 | |
| # with: | |
| # registry: docker.pkg.github.com | |
| # username: ${{ github.actor }} | |
| # password: ${{ secrets.GITHUB_TOKEN }} | |
| # - name: Publish image | |
| # uses: docker/build-push-action@v1 | |
| # with: | |
| # username: ${{ github.actor }} | |
| # password: ${{ secrets.GITHUB_TOKEN }} | |
| # registry: docker.pkg.github.com | |
| # repository: vkuznet/dbs2go/dbs2go | |
| # tag_with_ref: true | |
| # - 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/dbs2go:${{steps.get-ref.outputs.tag}} | |
| # - run: docker push cmssw/dbs2go:${{steps.get-ref.outputs.tag}} | |
| - name: Push new image to k8s | |
| if: "!contains(${{steps.get-ref.outputs.tag}}, 'dev')" | |
| 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,dbs,g" -e "s,TAG,${{steps.get-ref.outputs.tag}},g" -e "s,IMAGE,registry.cern.ch/cmsweb/dbs2go,g" -e "s,SERVICE,dbs2go,g" -e "s,HOST,${{secrets.IMAGEBOT_URL}},g" imagebot.sh | |
| chmod +x imagebot.sh | |
| cat imagebot.sh | |
| sh ./imagebot.sh |