Skip to content

Commit

Permalink
more changes to github workflows. run actions on tag, not on specific…
Browse files Browse the repository at this point in the history
… branch. Image ID made robust for buildah, tagging done with git describe --tags so that it will be correct even if the workflow is triggered manually
  • Loading branch information
cjtitus committed Dec 20, 2023
1 parent 35f46c0 commit 6f626a0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/push_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Build and Push Container Image

on:
push:
branches:
- release
tags:
workflow_dispatch:

jobs:
Expand All @@ -14,11 +13,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Get the latest tag
id: get_tag
run: echo ::set-output name=TAG::$(git describe --tags `git rev-list --tags --max-count=1`)

- name: Authenticate to ghcr
run: echo ${{ secrets.GHCR_PAT }} | buildah login --username cjtitus --password-stdin ghcr.io

- name: Run build script
run: bash buildah_scripts/build.sh

- name: Push image
run: buildah push simline:latest ghcr.io/${{ github.repository }}:${{ github.ref }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/simline
# Make sure IMAGE_ID is lowercase for buildah
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
buildah push simline:latest $IMAGE_ID:latest
buildah push simline:latest $IMAGE_ID:${{ steps.get_tag.outputs.TAG }}

0 comments on commit 6f626a0

Please sign in to comment.