chore: use token compatible with our rulesets (#27) #31
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: | |
push: | |
branches: | |
- main | |
permissions: write-all | |
env: | |
ACTIONS_RUNNER_DEBUG: true | |
ACTIONS_STEP_DEBUG: true | |
jobs: | |
release: | |
name: Run Release Manager | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config | |
persist-credentials: false | |
# Pull all previous tags | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Conventional Changelog Action | |
id: conventional-changelog | |
uses: TriPSs/conventional-changelog-action@v5 | |
with: | |
github-token: ${{ secrets.GH_TOKEN }} | |
skip-git-pull: true | |
skip-version-file: false | |
version-file: charts/sxt-node-chart/Chart.yaml | |
git-push: true | |
skip-on-empty: false # Always create commit | |
tag-prefix: "" #remove the 'v' prefix in tag | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.14.4 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
continue-on-error: true | |
with: | |
charts_dir: charts | |
env: | |
CR_TOKEN: "${{ secrets.GH_TOKEN }}" | |
- name: Continue chart-release | |
env: | |
CR_TOKEN: "${{ secrets.GH_TOKEN }}" | |
run: | | |
mkdir -p .cr-index .cr-release-packages | |
# download index.yaml or start as empty .. the index.yaml needs to be placed inside .cr-index/ | |
curl --fail https://spaceandtimelabs.github.io/sxt-node-chart-repo/index.yaml -o .cr-index/index.yaml || touch .cr-index/index.yaml | |
# download all known release packages, the packages needs to be placed inside .cr-release-packages/ | |
curl --fail -L -H "Authorization: token $CR_TOKEN" https://api.github.com/repos/spaceandtimelabs/sxt-node-chart-repo/releases | jq -r '.[].assets[] | (.name, .url)' | xargs -n 2 | while read name url; do | |
curl --fail -L -H "Authorization: token $CR_TOKEN" -H 'Accept: application/octet-stream' $url -o .cr-release-packages/$name | |
file .cr-release-packages/${i}.tgz |grep "gzip compressed data" || rm -f .cr-release-packages/${i}.tgz | |
done | |
# cr command.. will fail | |
cr index --owner "spaceandtimelabs" --git-repo sxt-node-chart-repo || cat .cr-index/index.yaml | |
git checkout -t origin/gh-pages | |
mv .cr-index/index.yaml index.yaml | |
git add index.yaml | |
git commit -m "update index.yaml" | |
git push origin HEAD |