|
1 |
| -name: Release Chart |
| 1 | +name: Create release # You may choose a different name |
| 2 | +run-name: ${{ inputs.releaseversion }} # Enumerates entries in the "workflow runs" view |
2 | 3 | on:
|
3 | 4 | workflow_dispatch:
|
4 | 5 | inputs:
|
5 | 6 | releaseversion:
|
6 |
| - description: Release version |
| 7 | + description: "Release version" |
7 | 8 | required: true
|
8 | 9 | type: string
|
9 |
| - default: X.Y.Z |
| 10 | + default: "X.Y.Z" |
| 11 | + |
10 | 12 | jobs:
|
11 |
| - release: |
12 |
| - # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions |
13 |
| - # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token |
| 13 | + release: # Arbitrarily chosen |
| 14 | + name: Release |
| 15 | + runs-on: ubuntu-latest |
14 | 16 | permissions:
|
15 | 17 | contents: write
|
16 |
| - runs-on: ubuntu-latest |
| 18 | + packages: write |
| 19 | + attestations: write |
| 20 | + id-token: write |
17 | 21 | steps:
|
| 22 | + - uses: actions/create-github-app-token@v1 |
| 23 | + id: app-token |
| 24 | + with: |
| 25 | + app-id: ${{ vars.CI_APP_ID }} |
| 26 | + private-key: ${{ secrets.CI_PRIVATE_KEY }} |
| 27 | + |
18 | 28 | - name: Checkout
|
19 | 29 | uses: actions/checkout@v4
|
20 | 30 | with:
|
21 | 31 | fetch-depth: 0
|
22 |
| - - name: Configure Git |
23 |
| - run: | |
24 |
| - git config user.name "$GITHUB_ACTOR" |
25 |
| - git config user.email "[email protected]" |
26 |
| - - name: Install Helm |
27 |
| - uses: azure/setup-helm@v4 |
28 |
| - - name: Install Python |
29 |
| - uses: actions/setup-python@v5 |
30 |
| - with: |
31 |
| - python-version: "3.9" |
32 |
| - check-latest: true |
33 |
| - - name: Set up chart-testing |
34 |
| - |
35 |
| - - name: Run chart-testing (lint) |
36 |
| - run: ct lint --config .ct.yaml |
37 |
| - - name: Run chart-releaser |
38 |
| - |
39 |
| - with: |
40 |
| - charts_dir: . |
41 |
| - config: .cr.yaml |
| 32 | + token: ${{ steps.app-token.outputs.token }} |
| 33 | + ref: ${{ github.head_ref }} |
| 34 | + |
| 35 | + - name: Get GitHub App User ID |
| 36 | + id: get-user-id |
| 37 | + run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" |
42 | 38 | env:
|
43 |
| - CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
44 |
| - - name: Login to GitHub Container Registry |
| 39 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 40 | + |
| 41 | + - name: Configure Git author |
45 | 42 | run: |
|
46 |
| - echo ${{ secrets.CT_OCI_GITHUB_TOKEN }} | helm registry login ghcr.io -u $ --password-stdin |
47 |
| - - name: Push Charts to GHCR |
| 43 | + git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' |
| 44 | + git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' |
| 45 | +
|
| 46 | + - name: Write version vars |
48 | 47 | run: |
|
49 |
| - for pkg in .cr-release-packages/*; do |
50 |
| - if [ -z "${pkg:-}" ]; then |
51 |
| - break |
52 |
| - fi |
53 |
| - helm push "${pkg}" oci://ghcr.io/cloudtooling/helm-charts |
54 |
| - done |
55 |
| - - name: tag-and-release |
56 |
| - id: tag-and-release |
57 |
| - uses: avakar/tag-and-release@v1 |
58 |
| - with: |
59 |
| - release_name: ${{ github.event.inputs.releaseversion }} |
60 |
| - tag_name: ${{ github.event.inputs.releaseversion }} |
61 |
| - draft: true |
62 |
| - env: |
63 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
64 |
| - - name: Add release of codelists zip to github release |
65 |
| - uses: actions/upload-release-asset@v1 |
| 48 | + echo "{\"version\":\"${{ github.event.inputs.releaseversion }}\"}" | jq > config.json |
| 49 | +
|
| 50 | + - name: Conventional Changelog Action |
| 51 | + uses: TriPSs/conventional-changelog-action@v6 |
| 52 | + with: |
| 53 | + input-file: CHANGELOG.md |
| 54 | + github-token: ${{ steps.app-token.outputs.token }} |
| 55 | + version-file: config.json |
| 56 | + pre-release: true |
| 57 | + skip-bump: true |
| 58 | + skip-tag: true |
| 59 | + skip-on-empty: true |
| 60 | + tag-prefix: "v" |
| 61 | + |
| 62 | + - name: Create Release on GH |
| 63 | + id: tag-and-release |
| 64 | + uses: avakar/tag-and-release@v1 |
| 65 | + with: |
| 66 | + draft: true |
| 67 | + release_name: ${{ github.event.inputs.releaseversion }} |
| 68 | + tag_name: v${{ github.event.inputs.releaseversion }} |
66 | 69 | env:
|
67 | 70 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
68 |
| - with: |
69 |
| - upload_url: ${{ steps.tag-and-release.outputs.upload_url }} |
70 |
| - asset_path: codelists/target/codelists-${{ github.event.inputs.releaseversion }}.jar |
71 |
| - asset_name: 3rdpartyGenCode-codelists.jar |
72 |
| - asset_content_type: application/zip |
0 commit comments