Skip to content

Commit

Permalink
github action - MyImage
Browse files Browse the repository at this point in the history
  • Loading branch information
n9 authored and n9 committed Jul 16, 2024
1 parent 0c89cdc commit 754d095
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/myimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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}}

0 comments on commit 754d095

Please sign in to comment.