Read-access to prod database #492
This file contains hidden or 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
| # This is a GitHub workflow defining a set of jobs with a set of steps. | |
| # ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
| # | |
| name: Publish chart | |
| # Trigger the workflow on pushed tags or commits to main branch. | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - ".github/workflows/*" | |
| - "!.github/workflows/publish-chart.yaml" | |
| push: | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - ".github/workflows/*" | |
| - "!.github/workflows/publish-chart.yaml" | |
| branches: | |
| - "main" | |
| tags: | |
| - "**" | |
| jobs: | |
| # Packages the Helm chart, and pushes it to 2i2c-org/frx-challenges@gh-pages. | |
| # | |
| publish: | |
| runs-on: ubuntu-22.04 | |
| # Explicitly request permissions to push to this git repository's gh-pages | |
| # branch via the the GITHUB_TOKEN we can have access to. | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # chartpress needs git history | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up QEMU (for docker buildx) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx (for chartpress multi-arch builds) | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Quay.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Install dependencies | |
| run: | | |
| pip install -r dev-requirements.txt | |
| pip list | |
| helm version | |
| - name: Configure a git user | |
| run: | | |
| git config --global user.email "github-actions@github.com" | |
| git config --global user.name "github-actions" | |
| - name: Build image and push | |
| run: | | |
| chartpress \ | |
| --builder docker-buildx \ | |
| --platform linux/amd64 --platform linux/arm64 | |
| - name: Publish chart with chartpress | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -eux | |
| PUBLISH_ARGS="--publish-chart --push" | |
| if [[ $GITHUB_REF != refs/tags/* ]]; then | |
| PR_OR_HASH=$(git log -1 --pretty=%h-%B | head -n1 | sed 's/^.*\(#[0-9]*\).*/\1/' | sed 's/^\([0-9a-f]*\)-.*/@\1/') | |
| LATEST_COMMIT_TITLE=$(git log -1 --pretty=%B | head -n1) | |
| EXTRA_MESSAGE="${{ github.repository }}${PR_OR_HASH} ${LATEST_COMMIT_TITLE}" | |
| chartpress $PUBLISH_ARGS --extra-message "${EXTRA_MESSAGE}" | |
| else | |
| chartpress $PUBLISH_ARGS --tag "${GITHUB_REF:10}" | |
| fi | |
| git --no-pager diff --color |