Skip to content

Merge pull request #97 from jordojordo/kw #80

Merge pull request #97 from jordojordo/kw

Merge pull request #97 from jordojordo/kw #80

name: Sync and Release Extensions
on:
release:
types: [released]
# Removing this trigger until the protected rule on the `main` branch does not limit actions.
push:
branches:
- main
paths:
- manifest.json
env:
ACTIONS_RUNNER_DEBUG: false
CI_COMMIT_MESSAGE: CI Build Artifacts
jobs:
sync-charts:
if: github.repository_owner == 'rancher' && github.ref_type != 'tag'
name: Sync and Release Extension Charts
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
deployments: write
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read secrets
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/org/rancher/github/rancher-ui-extension-release appId | APP_ID ;
secret/data/github/org/rancher/github/rancher-ui-extension-release privateKey | PRIVATE_KEY
- name: Generate Token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ env.APP_ID }}
private-key: ${{ env.PRIVATE_KEY }}
- name: Configure Git
run: |
git config user.name 'github-actions[rancher-ui-extension-releaser]'
git config user.email 'github-actions[rancher-ui-extension-releaser]@users.noreply.github.com'
- name: Setup Helm
uses: azure/setup-helm@v3
with:
version: v3.12.1
- name: Run sync-charts script
shell: bash
id: sync_charts_script
run: |
chmod +x ./scripts/sync-charts
./scripts/sync-charts
- name: Commit build
run: |
git add ./{assets,charts,extensions,icons,index.yaml}
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: ./charts/*
env:
# CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
CR_TOKEN: ${{ steps.generate-token.outputs.token }}
CR_SKIP_EXISTING: true
sync-catalogs:
if: github.repository_owner == 'rancher' && github.ref_type == 'tag'
name: Sync and Release Extension Catalog
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure Git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Login to Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Sync Catalog Image with Registry
id: sync_catalog_script
run: |
chmod +x ./scripts/bundle-catalog
./scripts/bundle-catalog -t ${{ github.ref_name }}