Merge pull request #10 from dyllamt/feature/permissions #6
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 Artifacts | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
helm-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Release Helm Charts | |
uses: helm/[email protected] | |
with: | |
skip_existing: true | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
helm-docs: | |
needs: helm-release | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.17' | |
- name: Generate Documentation | |
run: | | |
go install github.com/norwoodj/helm-docs/cmd/helm-docs@latest | |
cd charts | |
for d in */ ; do | |
helm-docs -c $d | |
done | |
- name: Checkout gh-pages Branch | |
uses: actions/checkout@v3 | |
with: | |
ref: 'gh-pages' | |
path: 'gh-pages' | |
- name: Copy Documentation to gh-pages | |
run: | | |
for CHART_DIR in charts/*; do | |
if [ -d "$CHART_DIR" ]; then # Ensure it's a directory | |
CHART_NAME=$(basename $CHART_DIR) | |
# Create a matching directory structure in gh-pages | |
mkdir -p gh-pages/$CHART_NAME | |
# Copy the README.md for the chart | |
cp $CHART_DIR/README.md gh-pages/$CHART_NAME/ | |
fi | |
done | |
- name: Commit and Push Changes to gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd gh-pages | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "Update documentation" -a || echo "No changes to commit" | |
git push origin gh-pages |