|
1 | 1 | name: Docs |
2 | 2 |
|
3 | | -# The published reference must describe a version people can install, so it is |
4 | | -# built from release tags rather than from main. workflow_dispatch is here for |
5 | | -# fixing the site itself (theme, landing page) without cutting a release. |
6 | 3 | on: |
7 | 4 | push: |
8 | 5 | tags: ["v*"] |
|
11 | 8 | permissions: |
12 | 9 | contents: read |
13 | 10 |
|
14 | | -# One deployment at a time: GitHub Pages rejects concurrent deploys. |
| 11 | +# GitHub Pages rejects concurrent deploys. |
15 | 12 | concurrency: |
16 | 13 | group: pages |
17 | 14 | cancel-in-progress: false |
|
21 | 18 | runs-on: ubuntu-latest |
22 | 19 | permissions: |
23 | 20 | contents: read |
24 | | - # configure-pages reads the site's base URL from the Pages API. It never |
25 | | - # creates the site: enablement defaults to false, so Pages has to be set |
26 | | - # to build from Actions by hand, and read is all this job needs. |
27 | | - pages: read |
| 21 | + pages: read # read the site's base URL from the Pages API |
28 | 22 | steps: |
29 | 23 | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
30 | 24 | with: |
|
43 | 37 | run: go run ./cmd/docgen -out website/content |
44 | 38 | - name: Build site |
45 | 39 | working-directory: website |
46 | | - # configure-pages reports the correct base URL, which differs between a |
47 | | - # project site (/flagsmith-cli/) and a custom domain. |
48 | 40 | run: hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/" |
49 | 41 | - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 |
50 | 42 | with: |
|
62 | 54 | steps: |
63 | 55 | - uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |
64 | 56 | id: deployment |
| 57 | + |
| 58 | + # The site only ever documents the newest release, so attach a copy to the |
| 59 | + # release itself for anyone staying on an older version. |
| 60 | + archive: |
| 61 | + if: github.ref_type == 'tag' |
| 62 | + runs-on: ubuntu-latest |
| 63 | + permissions: |
| 64 | + contents: write # upload a release asset |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 67 | + with: |
| 68 | + persist-credentials: false |
| 69 | + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| 70 | + with: |
| 71 | + go-version-file: go.mod |
| 72 | + - name: Package the reference |
| 73 | + run: | |
| 74 | + go run ./cmd/docgen -out "$RUNNER_TEMP/reference" |
| 75 | + tar -czf "$RUNNER_TEMP/flagsmith_${GITHUB_REF_NAME}_reference.tar.gz" -C "$RUNNER_TEMP" reference |
| 76 | + # Only tag_name and files are set: release-please owns the notes, and this |
| 77 | + # action leaves body, draft and prerelease alone when they are not passed. |
| 78 | + - uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 |
| 79 | + with: |
| 80 | + tag_name: ${{ github.ref_name }} |
| 81 | + files: ${{ runner.temp }}/flagsmith_*_reference.tar.gz |
| 82 | + fail_on_unmatched_files: true |
0 commit comments