Debian Codegraph @

.github/workflows/everything.yml

raw symbols SCIP
1 # ----------------------------------------------------------------------------
2 # GitHub Action workflow to release CGE build on GitHub.
3 #
4 # We call other workflows, this seems easiest way to wait for *all* other
5 # workflows and be able to get their artifacts.
6 # ----------------------------------------------------------------------------
7
8 name: Everything (Test, Pack, Release)
9 on:
10 pull_request:
11 # Run on push to any branch, not on tags.
12 # Checking tags is not useful for us (we check the commit when it happened
13 # at branch) and we would waste a lot of time on every "snapshpt" tag change.
14 push:
15 branches:
16 - '**'
17
18 env:
19 # To which GitHub release tag should we upload artifacts.
20 # Can be "snapshot" or "vX.Y.Z" (latter when we make stable release).
21 #release_tag: snapshot
22 release_tag: v7.0-alpha.3
23
24 defaults:
25 run:
26 shell: bash
27
28 jobs:
29 quick_test:
30 uses: ./.github/workflows/quick-test.yml
31 test_and_pack_docker:
32 uses: ./.github/workflows/test-and-pack-docker.yml
33 delphi:
34 uses: ./.github/workflows/delphi.yml
35 test_and_pack_runner_native:
36 uses: ./.github/workflows/test-and-pack-runner-native.yml
37 test_shell:
38 uses: ./.github/workflows/test-shell.yml
39 check_dependencies:
40 uses: ./.github/workflows/check-dependencies.yml
41 api_reference:
42 uses: ./.github/workflows/api-reference.yml
43
44 release:
45 name: Release
46 needs: [quick_test, test_and_pack_docker, delphi, test_and_pack_runner_native, test_shell, check_dependencies, api_reference]
47 if: ${{ github.ref == 'refs/heads/master' }}
48 runs-on: ubuntu-latest
49 steps:
50
51 # We can get artifacts from other workflows here, because we called them.
52 #
53 # History:
54 # Note that by default you cannot share artifacts between workflows.
55 # See
56 # https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#sharing-data-between-workflow-runs
57 # Solutions:
58 # - best, official https://github.com/actions/download-artifact?tab=readme-ov-file#download-artifacts-from-other-workflow-runs-or-repositories
59 # - alt: https://github.com/dawidd6/action-download-artifact
60 # - other, including download using cli: https://stackoverflow.com/questions/60355925/share-artifacts-between-workflows-github-actions
61
62 - name: Download packaged releases
63 uses: actions/download-artifact@v4
64 with:
65 merge-multiple: true
66 - name: List downloaded files
67 run: ls -R
68
69 # We use automatic GITHUB_TOKEN secret provided by GitHub with GH CLI, see
70 # https://docs.github.com/en/actions/security-guides/automatic-token-authentication
71 # https://docs.github.com/en/github-cli/github-cli/about-github-cli
72
73 - name: GH CLI status
74 env:
75 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 run: gh auth status
77 - name: GH CLI test
78 env:
79 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80 run: gh release list --repo ${{ github.repository }}
81
82 # Releases files in the GitHub release.
83 - name: Release Artifacts
84 if: ${{ github.ref == 'refs/heads/master' }}
85 run: gh release --repo ${{ github.repository }} upload ${{ env.release_tag }} --clobber castle-engine*.zip castle-engine-setup-*.exe
86 env:
87 GH_TOKEN: ${{ github.token }}
88
89 update-release-tag:
90 name: Update Release Tag (make release tag point to the build commit on master branch)
91 runs-on: ubuntu-latest
92 needs: [release]
93 steps:
94 - uses: actions/checkout@v4
95 - name: Update Release Tag
96 if: ${{ github.ref == 'refs/heads/master' }}
97 run: |
98 # --force allows to overwrite previous tag
99 git tag --force ${{ env.release_tag }}
100 # --force allows to push with overwritten tag
101 git push --force origin ${{ env.release_tag }}
102
103 # Make https://github.com/castle-engine/castle-engine-docker
104 # rebuild Docker image with the latest CGE snapshot.
105 #
106 # See repository_dispatch docs:
107 # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch
108 # https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event
109 - name: Dispatch updating Docker cge-unstable
110 env:
111 GH_TOKEN: ${{ secrets.GH_TOKEN_DISPATCH_DOCKER_UPDATE }}
112 run: |
113 gh api --method POST \
114 -H "Accept: application/vnd.github+json" \
115 -H "X-GitHub-Api-Version: 2022-11-28" \
116 /repos/castle-engine/castle-engine-docker/dispatches \
117 -f "event_type=cge-snapshot-changed" \
118 -F "client_payload[cge_commit_sha]=${{ github.sha }}"