Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Version updates + enable GHCR/container builds #226

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@ jobs:
runs-on: ubuntu-latest

outputs:
TAG: ${{ steps.tag.outputs.TAG || '0.3.6' }}
TAG: ${{ steps.tag.outputs.TAG }}

steps:
- name: Set TAG on release
if: startsWith(github.ref, 'refs/tags/v')
- name: Set TAG
id: tag
env:
TAG: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
run: |
TAG="$GITHUB_REF_NAME"
echo "TAG: $TAG"
if [[ -z $TAG ]]; then
TAG="$(git ls-remote --tags --refs https://github.com/liquidaty/zsv | cut -d '/' -f3 | tail -n1)"
fi
if [[ $TAG == "v"* ]]; then
TAG="${TAG:1}"
fi
echo "TAG: $TAG"
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
echo "TAG=$TAG" | tee -a "$GITHUB_OUTPUT"

clang-format:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -497,7 +498,6 @@ jobs:
./scripts/ci-update-homebrew-tap.sh

ghcr:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: [tag]
runs-on: ubuntu-latest

Expand All @@ -518,17 +518,18 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: Build and push (on release)
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
push: true
push: ${{ startsWith(github.ref, 'refs/tags/v') }}
tags: |
ghcr.io/liquidaty/zsv:${{ env.TAG }}
ghcr.io/liquidaty/zsv:latest