|
6 | 6 | - 'docs/pages/**'
|
7 | 7 | - '.github/workflows/**'
|
8 | 8 | workflow_dispatch:
|
9 |
| - inputs: |
10 |
| - build_id: |
11 |
| - description: 'Id of TeamCity build that produced the Dokka artifact.' |
12 |
| - required: true |
13 |
| - dry_run: |
14 |
| - type: boolean |
15 |
| - description: "Dry run. If set to true, the action will not actually publish the pages, but will assemble the artifact." |
16 |
| - default: true |
17 |
| - required: true |
18 | 9 |
|
19 | 10 | permissions:
|
20 | 11 | id-token: write
|
21 | 12 | pages: write
|
22 |
| - contents: read |
23 | 13 |
|
24 | 14 | env:
|
25 | 15 | INSTANCE: 'kotlinx-rpc/rpc'
|
|
30 | 20 | ALGOLIA_INDEX_NAME: 'prod_kotlin_rpc'
|
31 | 21 | ALGOLIA_KEY: '${{ secrets.ALGOLIA_KEY }}'
|
32 | 22 | CONFIG_JSON_PRODUCT: 'kotlinx-rpc'
|
33 |
| - CONFIG_JSON_VERSION: '0.8.0' |
34 |
| - DOKKA_ARTIFACT: 'dokka.zip' |
35 |
| - ASSEMBLE_DIR: '__docs_assembled' |
36 |
| - ASSEMBLE_ARTIFACT: 'assembled.zip' |
| 23 | + CONFIG_JSON_VERSION: '0.7.0' |
37 | 24 |
|
38 | 25 | jobs:
|
39 | 26 | build:
|
@@ -77,91 +64,37 @@ jobs:
|
77 | 64 | with:
|
78 | 65 | instance: ${{ env.INSTANCE }}
|
79 | 66 |
|
80 |
| - assemble: |
81 |
| - if: github.event_name == 'workflow_dispatch' |
82 |
| - needs: [ build, test ] |
83 |
| - runs-on: ubuntu-latest |
84 |
| - steps: |
85 |
| - - name: Checkout repository |
86 |
| - uses: actions/checkout@v4 |
87 |
| - with: |
88 |
| - fetch-depth: 0 |
89 |
| - |
90 |
| - - name: Download Writerside artifacts |
91 |
| - uses: actions/download-artifact@v4 |
92 |
| - with: |
93 |
| - name: kotlinx-rpc |
94 |
| - |
95 |
| - - name: Unzip Writerside artifacts |
96 |
| - run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }} |
97 |
| - |
98 |
| - - name: Download Dokka |
99 |
| - run: | |
100 |
| - if [ -z "${{ inputs.build_id }}" ]; then |
101 |
| - echo "'build_id' is not set" |
102 |
| - exit 1 |
103 |
| - fi |
104 |
| - |
105 |
| - echo "Downloading Dokka artifact, build id: ${{ inputs.build_id }}" |
106 |
| -
|
107 |
| - artifact_url="https://krpc.teamcity.com/app/rest/builds/id:${{ inputs.build_id }}/artifacts/content/${{ env.DOKKA_ARTIFACT }}" |
108 |
| - echo "Downloading Dokka artifact from URL: $artifact_url" |
109 |
| -
|
110 |
| - curl -v -s -f -L -H "Authorization: Bearer ${{ secrets.TEAMCITY_TOKEN }}" "$artifact_url" -o "${{ env.DOKKA_ARTIFACT }}" |
111 |
| - |
112 |
| - if [ -z "$(ls | grep -x ${{ env.DOKKA_ARTIFACT }})" ]; then |
113 |
| - echo "Failed to download Dokka artifact, asset id: ${{ inputs.build_id }}" |
114 |
| - exit 1 |
115 |
| - fi |
116 |
| -
|
117 |
| - - name: Unzip Dokka |
118 |
| - run: unzip -O UTF-8 -qq '${{ env.DOKKA_ARTIFACT }}' -d ${{ env.ASSEMBLE_DIR }}/api |
119 |
| - |
120 |
| - - name: Update sitemap.xml |
121 |
| - run: chmod +x updateSitemap.sh && ./updateSitemap.sh ${{ env.ASSEMBLE_DIR }}/sitemap.xml ${{ env.ASSEMBLE_DIR }}/api |
122 |
| - |
123 |
| - - name: Assemble file |
124 |
| - run: zip -r ${{ env.ASSEMBLE_ARTIFACT}} ${{ env.ASSEMBLE_DIR }} |
125 |
| - |
126 |
| - - name: Save assembled artifact |
127 |
| - uses: actions/upload-artifact@v4 |
128 |
| - with: |
129 |
| - name: kotlinx-rpc-assembled |
130 |
| - path: | |
131 |
| - ${{ env.ASSEMBLE_ARTIFACT }} |
132 |
| - retention-days: 7 |
133 |
| - |
134 | 67 | deploy:
|
135 |
| - if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/release-') && !inputs.dry_run |
| 68 | + if: github.event_name == 'workflow_dispatch' |
136 | 69 | environment:
|
137 | 70 | name: github-pages
|
138 | 71 | url: ${{ steps.deployment.outputs.page_url }}
|
139 |
| - needs: [ build, test, assemble ] |
| 72 | + needs: [ build, test ] |
140 | 73 | runs-on: ubuntu-latest
|
141 | 74 | steps:
|
142 | 75 | - name: Download artifacts
|
143 | 76 | uses: actions/download-artifact@v4
|
144 | 77 | with:
|
145 |
| - name: kotlinx-rpc-assembled |
| 78 | + name: kotlinx-rpc |
146 | 79 |
|
147 | 80 | - name: Unzip artifact
|
148 |
| - run: unzip -O UTF-8 -qq '${{ env.ASSEMBLE_ARTIFACT }}' -d publish |
| 81 | + run: unzip -O UTF-8 -qq '${{ env.ARTIFACT }}' -d dir |
149 | 82 |
|
150 | 83 | - name: Setup Pages
|
151 | 84 | uses: actions/configure-pages@v5
|
152 | 85 |
|
153 | 86 | - name: Package and upload Pages artifact
|
154 | 87 | uses: actions/upload-pages-artifact@v3
|
155 | 88 | with:
|
156 |
| - path: publish |
| 89 | + path: dir |
157 | 90 |
|
158 | 91 | - name: Deploy to GitHub Pages
|
159 | 92 | id: deployment
|
160 | 93 | uses: actions/deploy-pages@v4
|
161 | 94 |
|
162 | 95 | publish-indexes:
|
163 |
| - if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/heads/release-') && !inputs.dry_run |
164 |
| - needs: [ build, test, assemble, deploy ] |
| 96 | + if: github.event_name == 'workflow_dispatch' |
| 97 | + needs: [ build, test, deploy ] |
165 | 98 | runs-on: ubuntu-latest
|
166 | 99 | container:
|
167 | 100 | image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-3
|
|
0 commit comments