Use a temporary redirect #11
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: Publish package to GHCR | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| env: | |
| IMAGE_NAME: redirector | |
| jobs: | |
| ghr_push: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Build docker image | |
| run: docker build . --file Dockerfile --tag $IMAGE_NAME --build-arg commit="$GITHUB_SHA" | |
| - name: Sign in to GHCR | |
| run: echo "${{ secrets.MY_TOKEN}}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Push image to GHCR | |
| run: | | |
| IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
| [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
| [ "$VERSION" == "master" ] && VERSION=latest | |
| [ "$VERSION" == "develop" ] && VERSION=develop | |
| echo "::notice IMAGE_ID=$IMAGE_ID" | |
| echo "::notice VERSION=$VERSION" | |
| docker tag $IMAGE_NAME $IMAGE_ID:$VERSION | |
| docker push $IMAGE_ID:$VERSION |