Update ArgoCD version (#17) #18
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: GoRelease | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
env: | |
# Common versions | |
GO_VERSION: '1.19' | |
GO_REQUIRED_MIN_VERSION: '' | |
GOPATH: '/home/runner/work/argocd-pull-integration/go' | |
GITHUB_REF: ${{ github.ref }} | |
CHART_NAME: 'argocd-pull-integration' | |
defaults: | |
run: | |
working-directory: go/src/open-cluster-management.io/argocd-pull-integration | |
jobs: | |
env: | |
name: prepare env | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
path: go/src/open-cluster-management.io/argocd-pull-integration | |
- name: get release version | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: get major release version | |
run: | | |
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV | |
echo "TRIMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV | |
- name: verify chart version | |
run: | | |
cat ./charts/argocd-pull-integration/Chart.yaml | grep -q 'version: ${{ env.TRIMED_RELEASE_VERSION }}' | |
outputs: | |
MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }} | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
TRIMED_RELEASE_VERSION: ${{ env.TRIMED_RELEASE_VERSION }} | |
images: | |
name: images | |
runs-on: ubuntu-latest | |
needs: [ env ] | |
strategy: | |
matrix: | |
arch: [ amd64 ] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
path: go/src/open-cluster-management.io/argocd-pull-integration | |
- name: install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: install imagebuilder | |
run: go install github.com/openshift/imagebuilder/cmd/[email protected] | |
- name: pull base image | |
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }} | |
- name: images | |
run: | | |
IMG=quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \ | |
IMAGE_BUILD_EXTRA_FLAGS="--build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}" \ | |
make docker-build | |
- name: push | |
run: | | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin | |
docker push quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} | |
image-manifest: | |
name: image manifest | |
runs-on: ubuntu-latest | |
needs: [ env, images ] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
path: go/src/open-cluster-management.io/argocd-pull-integration | |
- name: create | |
run: | | |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin | |
docker manifest create quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }} \ | |
quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 | |
- name: annotate | |
run: | | |
docker manifest annotate quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }} \ | |
quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64 | |
- name: push | |
run: | | |
docker manifest push quay.io/open-cluster-management/argocd-pull-integration:${{ needs.env.outputs.RELEASE_VERSION }} | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
needs: [ env, image-manifest ] | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
path: go/src/open-cluster-management.io/argocd-pull-integration | |
- name: setup helm | |
uses: azure/setup-helm@v1 | |
- name: chart package | |
run: | | |
mkdir -p release | |
pushd release | |
helm package ../charts/${{ env.CHART_NAME }}/ | |
popd | |
- name: publish release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.RELEASE_VERSION }} | |
artifacts: "go/src/open-cluster-management.io/argocd-pull-integration/release/*.tgz" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: submit charts to OCM chart repo | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.OCM_BOT_PAT }} | |
script: | | |
try { | |
const result = await github.rest.actions.createWorkflowDispatch({ | |
owner: 'open-cluster-management-io', | |
repo: 'helm-charts', | |
workflow_id: 'download-chart.yml', | |
ref: 'main', | |
inputs: { | |
repo: "${{ github.repository }}", | |
version: "${{ needs.env.outputs.TRIMED_RELEASE_VERSION }}", | |
"chart-name": "${{ env.CHART_NAME }}", | |
}, | |
}) | |
console.log(result); | |
} catch(error) { | |
console.error(error); | |
core.setFailed(error); | |
} |