push image to ghcr #6
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: CD Build Go Lang App | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]+\.[0-9]+\.[0-9]+' | |
| jobs: | |
| pushCiBuildDockerImage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - name: Set Tag Name | |
| id: get_tag_name | |
| run: echo ::set-output name=tag_name::$(echo ${GITHUB_REF##*/}) | |
| - name: Set Variables With Build Info | |
| id: job_info | |
| run: | | |
| curl -v -L -u runner:${{ secrets.GITHUB_TOKEN }} -o job_info.json https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }}/jobs | |
| echo ::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY##*/}) | |
| - name: Capture environment variables | |
| run: printenv | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build | |
| id: build_and_push | |
| uses: docker/build-push-action@v2 | |
| with: | |
| buil-args: | | |
| STEP_1_IMAGE=golang:1.15.6-alpine3.12 | |
| STEP_2_IMAGE=alpine:3.12 | |
| file: build/docker/Dockerfile | |
| tags: | | |
| ghcr.io/bunnyway/gitactions-slack-notification:${{ github.sha }} | |
| ghcr.io/bunnyway/gitactions-slack-notification:latest | |
| ghcr.io/bunnyway/gitactions-slack-notification:${{ steps.get_tag_name.outputs.tag_name }} | |
| - name: Push to GHCR | |
| run: | | |
| docker push ghcr.io/bunnyway/gitactions-slack-notification:latest | |
| docker push ghcr.io/bunnyway/gitactions-slack-notification:${{ steps.get_tag_name.outputs.tag_name }} |