Skip to content

feat(repo): add Actions workflows to manage versions and releases with Pipeline #12

feat(repo): add Actions workflows to manage versions and releases with Pipeline

feat(repo): add Actions workflows to manage versions and releases with Pipeline #12

Workflow file for this run

name: Publish Nx Cloud CE Release
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
#on:
# push:
# tags:
# - 'v*'
permissions: {}
jobs:
retag-oci-images:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # for creating OIDC tokens for signing.
packages: write # used to push images to `ghcr.io` if used.
strategy:
matrix:
include:
- image: ghcr.io/clementguillot/nx-cloud-ce-server
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Skopeo
uses: warjiang/setup-skopeo@71776e03c10d767c04af8924fe5a67763f9b3d34 # v0.1.3
with:
version: latest
- name: Extract tag and commit SHA
id: vars
run: |
echo "TAG=v0.0.1" >> $GITHUB_ENV
SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
- name: Sync images
run: |
skopeo --version
echo ${{ secrets.GITHUB_TOKEN }} | skopeo login -u ${{ github.actor }} --password-stdin ghcr.io
# skopeo copy --all \
# docker://${{ matrix.image }}:${{ env.SHORT_SHA }} \
# docker://${{ matrix.image }}:${{ env.TAG }}
publish-helm-charts:
runs-on: ubuntu-latest
permissions:
contents: write # for helm/chart-releaser-action to push chart release and create a release
packages: write # to push OCI chart package to GitHub Registry
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: v3.14.4
- uses: ./.github/actions/setup-tools
- run: npx nx build apps/helm-chart
# - name: Add dependency chart repos
# run: |
# helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: "helm-chart-{{ .Version }}"
with:
skip_packaging: true
# skip_existing: true
# charts_repo_url: https://charts.external-secrets.io
# generate-release-notes: true
- name: Login to GHCR
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push chart to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"
done