Migrate from AZDO to GitHub Actions #74
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 Helm charts | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
check-app: | |
name: Check if commit was pushed by GitHub App | |
runs-on: ubuntu-latest | |
outputs: | |
pushed-by-app: ${{ steps.check-app.outputs.pushed-by-app }} | |
steps: | |
- name: Check if commit was pushed by GitHub App | |
id: check-app | |
run: | | |
if [[ '${{ github.actor }}' == '${{ vars.GH_APP_USERNAME }}' ]]; then | |
echo 'Commit was pushed by GitHub App.' | |
echo "pushed-by-app=true" >> "$GITHUB_OUTPUT" | |
fi | |
publish-helm-charts: | |
name: Publish Helm charts | |
runs-on: elvia-runner | |
needs: [check-app] | |
if: ${{ needs.check-app.outputs.pushed-by-app != 'true' }} | |
steps: | |
- name: Get GitHub App token for repository | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
fetch-depth: 0 | |
ref: ${{github.event.pull_request.head.ref}} | |
- name: Package charts | |
run: | | |
helm package elvia-deployment | |
helm package elvia-statefulset | |
helm package iss-deployment | |
- name: Index Helm repository | |
run: helm repo index . | |
- name: Push packaged charts to GitHub repository | |
# Only on push to master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
if [[ -z "$(git status --porcelain)" ]]; then | |
echo 'No changes to commit.' | |
exit 0 | |
fi | |
git config user.email '${{ vars.GH_APP_USER_EMAIL }}' | |
git config user.name '${{ vars.GH_APP_USERNAME }}' | |
git add . | |
git commit -m 'Publish Helm charts' | |
git push |