diff options
| author | unitexe <unitexe70@gmail.com> | 2026-01-04 14:46:47 -0600 |
|---|---|---|
| committer | unitexe <unitexe70@gmail.com> | 2026-01-04 14:53:55 -0600 |
| commit | a069061283c96b3939d7ed8836cf75c38186bbcd (patch) | |
| tree | 739c29be240496739c4941158d89bc80b9d2c66f /.github/workflows/ci.yml | |
| parent | 74ed0e88ea1acfc88fc267dab8c30177119c1869 (diff) | |
Github workflow that builds image using buildah and pushes to GHCRv/0.1.0
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0609c43 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: Banner Container +on: + push: + tags: + - 'v/**' + branches: + - main + - main-next + workflow_dispatch: + +env: + IMAGE_NAME: banner + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + +jobs: + build-and-push: + name: Build and push image + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Install QEMU dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Determine tags + id: tags + run: | + TAGS="${{ github.sha }}" + + if [[ "${{ github.ref }}" == refs/tags/v/* ]]; then + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v/}" + TAGS="${VERSION} latest ${TAGS}" + fi + + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + echo "Generated tags: ${TAGS}" + + - name: Build image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: ${{ steps.tags.outputs.tags }} + archs: amd64, arm64 + containerfiles: | + ./Containerfile + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.description=Custom banner container + org.opencontainers.image.licenses=MIT + + - name: Push to GHCR + uses: redhat-actions/push-to-registry@v2 + id: push + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ env.IMAGE_REGISTRY }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + + - name: Echo outputs + run: | + echo "${{ toJSON(steps.push.outputs) }}" |
