Skip to content

github action - MyImage #28

github action - MyImage

github action - MyImage #28

Workflow file for this run

name: MyImage
on:
push:
branches:
- master
pull_request:
branches:
- master
types: [ labeled, unlabeled, opened, synchronize, reopened ]
env:
GOLANG_VERSION: '1.20'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
publish:
permissions:
contents: write # for git to push upgrade commit if not already deployed
packages: write # for pushing packages to GHCR, which is used by cd.apps.n9.io to avoid polluting Quay with tags
runs-on: ubuntu-22.04
env:
GOPATH: /home/runner/work/argo-cd
steps:
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ env.GOLANG_VERSION }}
- uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
with:
path: ./src/argo-cd
# get image tag
- run: |
echo "tag=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
echo "shorttag=$(cat ./VERSION)" >> $GITHUB_OUTPUT
working-directory: ./src/argo-cd
id: image
# login
- run: |
docker login ghcr.io --username $USERNAME --password-stdin <<< "$PASSWORD"
if: github.event_name == 'push'
env:
USERNAME: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
# build
- uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 #v4.1.1
with:
context: ./src/argo-cd
platforms: linux/amd64
push: ${{ github.event_name == 'push' }}
tags: |
ghcr.io/n9/argo-cd/argocd:${{ steps.image.outputs.tag }}
ghcr.io/n9/argo-cd/argocd:${{ steps.image.outputs.shorttag }}
provenance: false
sbom: false
build-args: |
GIT_TAG=${{env.GIT_TAG}}
GIT_COMMIT=${{env.GIT_COMMIT}}
BUILD_DATE=${{env.BUILD_DATE}}
GIT_TREE_STATE=${{env.GIT_TREE_STATE}}