feat(repo): add Actions workflows to manage versions and releases with Pipeline #13
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: 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 | |
- name: Setup Build Tools | |
uses: ./.github/actions/setup-tools | |
- name: Build Helm Chart | |
run: npx nx build apps/helm-chart | |
- 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 | |
- 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 |