name: Publish Staging on: push: branches: - main jobs: release: name: Push Docker image to GitHub Packages runs-on: ubuntu-latest permissions: packages: write contents: read steps: - name: Checkout the repo uses: actions/checkout@v2 - name: Login to GitHub Docker Registry uses: docker/login-action@v1 with: registry: docker.pkg.github.com username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Format repository run: | echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV - name: Build container image uses: docker/build-push-action@v2 with: push: true tags: | docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:${{ github.sha }} docker.pkg.github.com/${{ env.IMAGE_REPOSITORY }}/ccash:latest