Add golden tests for GitLab job generator Jsonnet script #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build & Push GitLab Container Image | |
"on": | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE: ${{ github.repository }}/gitlab | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set image version latest | |
if: github.ref == 'refs/heads/main' | |
run: echo "VERSION=latest" >> ${GITHUB_ENV} | |
- name: Set image version for PRs to branch name | |
if: github.event_name == 'pull_request' | |
run: echo "VERSION=${GITHUB_HEAD_REF//\//-}" >> ${GITHUB_ENV} | |
- name: Set image version from tag | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> ${GITHUB_ENV} | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v6 | |
with: | |
context: '{{defaultContext}}:gitlab' | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: 'ghcr.io/${{ env.IMAGE }}:${{ env.VERSION }}' |