Skip to content

Commit

Permalink
Update GH Actions pipeline for modern versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinna Kiisuo committed Dec 6, 2023
1 parent 4bd9c09 commit 3dd2401
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get the release channel
id: get_channel
shell: bash
run: |
if [[ "$GITHUB_REF" == 'refs/heads/main' ]]; then
echo ::set-output name=channel::"latest"
echo ::set-output name=version::main_${GITHUB_SHA::6}
echo "channel=latest" >> $GITHUB_OUTPUT
echo "version=main_${GITHUB_SHA::6}" >> $GITHUB_OUTPUT
elif [[ "$GITHUB_REF" == "refs/heads/"* ]]; then
echo ::set-output name=version::${GITHUB_REF/refs\/heads\//}_${GITHUB_SHA::6}
echo "version=${GITHUB_REF/refs\/heads\//}_${GITHUB_SHA::6}" >> $GITHUB_OUTPUT
elif [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
echo ::set-output name=channel::${GITHUB_REF/refs\/tags\//}
echo "channel=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
fi
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.get_channel.outputs.channel }}
type=raw,value=${{ steps.get_channel.outputs.version }}
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down

0 comments on commit 3dd2401

Please sign in to comment.