chore: align releases and CI with DiracX #798
Workflow file for this run
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
| name: Deployment | |
| on: | |
| push: | |
| branches-ignore: | |
| - renovate/** | |
| - release-please-** | |
| pull_request: | |
| branches-ignore: | |
| - release-please-** | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }} | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} | |
| target-branch: ${{ github.ref_name }} | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| # Library is built and deployed to NPM | |
| # ------------------------------------ | |
| build-deploy-library-package: | |
| runs-on: ubuntu-latest | |
| needs: release-please | |
| if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && needs.release-please.outputs.release_created == 'true' }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| # Release Please has already incremented versions and published tags, so we just | |
| # need to publish all unpublished versions to NPM here | |
| - name: Publish to NPM | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
| run: npm --workspace packages/diracx-web-components publish | |
| # Storybook is built and deployed to GitHub Pages | |
| # ----------------------------------------------- | |
| build-storybook-docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| pages: write | |
| if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'npm' | |
| - name: Build documentation | |
| run: npm ci && npm --prefix packages/diracx-web-components run build-doc | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: packages/diracx-web-components/storybook-static | |
| deploy-storybook-docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| pages: write | |
| needs: [build-storybook-docs, release-please] | |
| if: needs.release-please.outputs.release_created == 'true' | |
| steps: | |
| - id: deploy | |
| name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| token: ${{ github.token }} | |
| # diracx-web is built and deployed to GitHub Container Registry | |
| # ------------------------------------------------------------- | |
| build-deploy-diracx-web-dev-image: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub container registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker image (dev) | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' && github.ref_name == 'main' }} | |
| tags: ghcr.io/diracgrid/diracx-web/static:dev | |
| platforms: linux/amd64,linux/arm64 | |
| build-deploy-diracx-web-release-image: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/diracx-web' }} | |
| needs: release-please | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to GitHub container registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build Docker image | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: true | |
| tags: ghcr.io/diracgrid/diracx-web/static:${{ needs.release-please.outputs.tag_name }} | |
| platforms: linux/amd64,linux/arm64 | |
| # Helm charts are updated in diracx-charts | |
| # ----------------------------------------- | |
| update-charts: | |
| name: Update Helm charts | |
| needs: | |
| - release-please | |
| - build-deploy-diracx-web-release-image | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| steps: | |
| - name: Checkout diracx-web (for update script) | |
| uses: actions/checkout@v6 | |
| with: | |
| path: diracx-web | |
| sparse-checkout: .github/workflows | |
| - name: Checkout diracx-charts | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: DIRACGrid/diracx-charts | |
| token: ${{ secrets.CHARTS_UPDATE_TOKEN }} | |
| path: diracx-charts | |
| - name: Configure Git | |
| run: | | |
| cd diracx-charts | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Update chart versions | |
| run: | | |
| python diracx-web/.github/workflows/update_chart_version.py \ | |
| --charts-dir diracx-charts \ | |
| --web-version "${{ needs.release-please.outputs.tag_name }}" | |
| - name: Install pre-commit | |
| run: pip install pre-commit | |
| - name: Run pre-commit to update README | |
| run: | | |
| cd diracx-charts | |
| pre-commit run --all-files || true | |
| - name: Commit and push changes | |
| if: success() | |
| run: | | |
| cd diracx-charts | |
| git add -A | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: bump diracx-web to ${{ needs.release-please.outputs.tag_name }}" | |
| git push origin master | |
| else | |
| echo "No changes to commit" | |
| fi |