diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b141911ee..9e64a5624b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,6 @@ jobs: max_releases: 1 - name: upload build as workflow artifact - if: github.event_name != 'schedule' uses: actions/upload-artifact@v2 with: path: release/RaspberryMatic-${{ env.VERSION }}-${{ matrix.platform }}.zip* @@ -227,11 +226,24 @@ jobs: unzip -f $f done - - name: Extract branch name + - name: Build tags shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})" + run: | + BASE_TAG="ghcr.io/${{ github.repository_owner }}/raspberrymatic" + TAGS="${BASE_TAG}:${{ env.VERSION }}-${{ env.GITHUB_SHA7 }}" + if [[ ${GITHUB_EVENT_NAME} = 'schedule' || ${GITHUB_EVENT_NAME} = 'push' ]]; then + BRANCH="${GITHUB_REF##*/}" + if [ $BRANCH = master ]; then + TAGS="${TAGS} ${BASE_TAG}:snapshot" + else + TAGS="${TAGS}"$'\n'"${BASE_TAG}:snapshot-${BRANCH}" + fi + fi + echo "##[set-output name=image_tags;]${TAGS}" id: extract_branch + - uses: docker/setup-buildx-action@v1 + - name: build and push container image uses: docker/build-push-action@v2 id: docker_build @@ -242,9 +254,7 @@ jobs: push: true build-args: | tar_prefix=RaspberryMatic-${{ env.VERSION }}-${{ env.GITHUB_SHA7 }}-oci_ - tags: | - ghcr.io/${{ github.repository_owner }}/raspberrymatic:${{ env.VERSION }}-${{ env.GITHUB_SHA7 }} - ghcr.io/${{ github.repository_owner }}/raspberrymatic:${{ steps.extract_branch.outputs.branch }} + tags: ${{ steps.extract_branch.outputs.image_tags }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} \ No newline at end of file