SBCOSS-399: created workflow to publish image to ghcr #2
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 and Publish Docker Image | |
| on: | |
| push: | |
| tags: | |
| - 'release*' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker image name | |
| id: vars | |
| run: echo "IMAGE_NAME=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV | |
| - name: Build Docker image | |
| run: | | |
| docker build -t $IMAGE_NAME:${{ github.ref_name }} . | |
| - name: Push Docker image | |
| run: | | |
| docker push $IMAGE_NAME:${{ github.ref_name }} |