Release #21
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: Git tag to build release from | |
required: true | |
update_stable_tag: | |
description: 'Update stable tag' | |
required: true | |
type: boolean | |
default: 'false' | |
permissions: | |
contents: read | |
jobs: | |
release-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
- name: Get SHA | |
id: get-sha | |
run: echo "::set-output name=sha::$(git log -1 --format='%H')" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
config-inline: | | |
[worker.oci] | |
gc = false | |
- name: Print Disk Usage | |
run: | | |
df -ah | |
docker buildx du | |
- name: Docker meta (controller) | |
id: controller-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
quay.io/codefresh/argo-rollouts | |
# ghcr.io/codefresh-io/argo-rollouts | |
tags: | | |
type=semver,pattern={{version}},prefix=v,value=${{ github.event.inputs.tag }} | |
flavor: | | |
latest=false | |
- name: Docker meta (plugin) | |
id: plugin-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
quay.io/codefresh/kubectl-argo-rollouts | |
# ghcr.io/codefresh-io/kubectl-argo-rollouts | |
tags: | | |
type=semver,pattern={{version}},prefix=v,value=${{ github.event.inputs.tag }} | |
flavor: | | |
latest=false | |
# - name: Login to GitHub Container Registry | |
# if: github.event_name != 'pull_request' | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Quay.io | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
- name: Build and push (controller-image) | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.controller-meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
- name: Build and push (plugin-image) | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0 | |
with: | |
context: . | |
target: kubectl-argo-rollouts | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.plugin-meta.outputs.tags }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
release-artifacts: | |
permissions: | |
contents: write # for softprops/action-gh-release to create GitHub release | |
runs-on: ubuntu-latest | |
needs: release-images | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
- name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19 | |
- name: Generate release artifacts | |
run: | | |
make release-plugins | |
make manifests IMAGE_TAG=${{ github.event.inputs.tag }} | |
- name: Generate SBOM (spdx) | |
id: spdx-builder | |
env: | |
# defines the spdx/spdx-sbom-generator version to use. | |
SPDX_GEN_VERSION: v0.0.13 | |
# defines the sigs.k8s.io/bom version to use. | |
SIGS_BOM_VERSION: v0.2.1 | |
# comma delimited list of project relative folders to inspect for package | |
# managers (gomod, yarn, npm). | |
PROJECT_FOLDERS: ".,./ui" | |
# full qualified name of the docker image to be inspected | |
DOCKER_IMAGE: quay.io/codefresh/argo-rollouts:${{ github.event.inputs.tag }} | |
run: | | |
yarn install --cwd ./ui | |
go install github.com/spdx/spdx-sbom-generator/cmd/generator@$SPDX_GEN_VERSION | |
go install sigs.k8s.io/bom/cmd/bom@$SIGS_BOM_VERSION | |
# Generate SPDX for project dependencies analyzing package managers | |
for folder in $(echo $PROJECT_FOLDERS | sed "s/,/ /g") | |
do | |
generator -p $folder -o /tmp | |
done | |
# Generate SPDX for binaries analyzing the docker image | |
if [[ ! -z $DOCKER_IMAGE ]]; then | |
bom generate -o /tmp/bom-docker-image.spdx -i $DOCKER_IMAGE | |
fi | |
cd /tmp && tar -zcf sbom.tar.gz *.spdx | |
- name: Draft release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
draft: true | |
files: | | |
dist/kubectl-argo-rollouts-linux-amd64 | |
dist/kubectl-argo-rollouts-linux-arm64 | |
dist/kubectl-argo-rollouts-darwin-amd64 | |
dist/kubectl-argo-rollouts-windows-amd64 | |
manifests/dashboard-install.yaml | |
manifests/install.yaml | |
manifests/namespace-install.yaml | |
manifests/notifications-install.yaml | |
docs/features/kustomize/rollout_cr_schema.json | |
/tmp/sbom.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |