Update cookies link #16
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: Build and deploy | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - feature/* | |
| concurrency: | |
| group: cd-${{ github.ref }} | |
| jobs: | |
| test-node: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: ./.github/actions/node-tests | |
| test-playwright: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: ./.github/actions/playwright-tests | |
| test-python: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| uses: ./.github/actions/python-tests | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test-node | |
| - test-playwright | |
| - test-python | |
| permissions: | |
| packages: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate version tag | |
| id: version-tag | |
| uses: nationalarchives/ds-docker-actions/.github/actions/get-version-tag@main | |
| - name: Build Docker image | |
| uses: nationalarchives/ds-docker-actions/.github/actions/build@main | |
| with: | |
| version: ${{ steps.version-tag.outputs.version-tag }} | |
| latest: ${{ github.ref == 'refs/heads/main' }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| docker-image-name: ${{ vars.DOCKER_IMAGE_NAME }} | |
| wiz-client-id: ${{ secrets.WIZ_CLIENT_ID }} | |
| wiz-client-secret: ${{ secrets.WIZ_CLIENT_SECRET }} | |
| wiz-project-id: ${{ secrets.WIZ_PROJECT_DIGITALSERVICES }} | |
| - name: Create tag | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/github-script@v5 | |
| with: | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: 'refs/tags/v${{ steps.version-tag.outputs.version-tag }}', | |
| sha: context.sha | |
| }) | |
| outputs: | |
| version: ${{ steps.version-tag.outputs.version-tag }} | |
| update-ds-infrastructure-web: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: | |
| - build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: nationalarchives/ds-infrastructure-web | |
| ref: main | |
| token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | |
| - name: Set up git config | |
| run: | | |
| git config user.name "${{ github.triggering_actor }}" | |
| git config user.email "<>" | |
| - name: Install jq | |
| run: sudo apt-get install jq | |
| - name: Update config | |
| run: jq --indent 4 '(.services.forms.version|="${{ needs.build.outputs.version }}")' config/develop.json > tmp.$$.json && mv tmp.$$.json config/develop.json | |
| - name: Push new version | |
| run: | | |
| git add config/develop.json | |
| COMMIT_MESSAGE_HEADER=$(git log -1 --pretty=%B | head -n 1) | |
| git commit -m "Update forms to v${{ needs.build.outputs.version }}" -m "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" | |
| git push origin main | |
| update-dblclk: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: | |
| - build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: nationalarchives/ds-etna | |
| ref: proof-of-concept | |
| token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | |
| - name: Set up git config | |
| run: | | |
| git config user.name "${{ github.triggering_actor }}" | |
| git config user.email "<>" | |
| - name: Install yq | |
| uses: dcarbone/install-yq-action@v1.1.1 | |
| - name: Update config | |
| run: | | |
| yq '(.services.forms.image|="ghcr.io/${{ github.repository_owner }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ needs.build.outputs.version }}")' docker-compose.yml > tmp.$$.yml && mv tmp.$$.yml docker-compose.yml | |
| - name: Push new version | |
| run: | | |
| git add docker-compose.yml | |
| COMMIT_MESSAGE_HEADER=$(git log -1 --pretty=%B | head -n 1) | |
| git commit -m "Update forms to v${{ needs.build.outputs.version }}" -m "${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}" | |
| git push origin proof-of-concept |