|
8 | 8 |
|
9 | 9 | permissions: |
10 | 10 | contents: read |
11 | | - pages: write |
12 | | - id-token: write |
13 | 11 |
|
14 | 12 | jobs: |
15 | 13 | build-manifests: |
@@ -56,47 +54,18 @@ jobs: |
56 | 54 | CXX: g++-13 |
57 | 55 | ICEY_SOURCE_DIR: ${{ github.workspace }}/icey |
58 | 56 | BUILD_DIR: ${{ github.workspace }}/build-release |
59 | | - APT_BASE_URL: https://nilstate.github.io/icey-cli/apt |
| 57 | + APT_BASE_URL: https://nilstate.github.io/0state-packages/icey |
60 | 58 | run: ./scripts/package-manager-check.sh |
61 | 59 |
|
62 | | - - name: Prepare Pages artifact |
63 | | - run: | |
64 | | - rm -rf .stage/pages |
65 | | - mkdir -p .stage/pages/apt |
66 | | - cp -R .stage/apt-repo/. .stage/pages/apt/ |
67 | | - cat > .stage/pages/index.html <<'EOF' |
68 | | - <!doctype html> |
69 | | - <html lang="en"> |
70 | | - <head> |
71 | | - <meta charset="utf-8"> |
72 | | - <title>icey package repositories</title> |
73 | | - </head> |
74 | | - <body> |
75 | | - <p>APT repository: <a href="./apt/">./apt/</a></p> |
76 | | - </body> |
77 | | - </html> |
78 | | - EOF |
79 | | -
|
80 | 60 | - uses: actions/upload-artifact@v4 |
81 | 61 | with: |
82 | 62 | name: package-managers-rendered |
83 | 63 | path: .stage/package-managers/rendered |
84 | 64 |
|
85 | | - - uses: actions/configure-pages@v5 |
86 | | - |
87 | | - - uses: actions/upload-pages-artifact@v3 |
| 65 | + - uses: actions/upload-artifact@v4 |
88 | 66 | with: |
89 | | - path: .stage/pages |
90 | | - |
91 | | - deploy-apt-pages: |
92 | | - runs-on: ubuntu-24.04 |
93 | | - needs: build-manifests |
94 | | - environment: |
95 | | - name: github-pages |
96 | | - url: ${{ steps.deployment.outputs.page_url }} |
97 | | - steps: |
98 | | - - id: deployment |
99 | | - uses: actions/deploy-pages@v4 |
| 67 | + name: apt-repo |
| 68 | + path: .stage/apt-repo |
100 | 69 |
|
101 | 70 | publish-homebrew: |
102 | 71 | runs-on: ubuntu-24.04 |
@@ -149,6 +118,59 @@ jobs: |
149 | 118 | git -C .stage/homebrew-tap commit -m "icey-server ${{ needs.build-manifests.outputs.cli_version }}" |
150 | 119 | git -C .stage/homebrew-tap push |
151 | 120 |
|
| 121 | + publish-apt-repo: |
| 122 | + runs-on: ubuntu-24.04 |
| 123 | + needs: build-manifests |
| 124 | + steps: |
| 125 | + - name: Check package repo credentials |
| 126 | + id: gate |
| 127 | + env: |
| 128 | + PACKAGES_REPO_TOKEN: ${{ secrets.PACKAGES_REPO_TOKEN }} |
| 129 | + run: | |
| 130 | + if [[ -n "${PACKAGES_REPO_TOKEN:-}" ]]; then |
| 131 | + echo "publish=true" >> "$GITHUB_OUTPUT" |
| 132 | + else |
| 133 | + echo "publish=false" >> "$GITHUB_OUTPUT" |
| 134 | + echo "Skipping APT publish: PACKAGES_REPO_TOKEN is not configured." |
| 135 | + fi |
| 136 | +
|
| 137 | + - uses: actions/checkout@v4 |
| 138 | + if: steps.gate.outputs.publish == 'true' |
| 139 | + |
| 140 | + - uses: actions/download-artifact@v4 |
| 141 | + if: steps.gate.outputs.publish == 'true' |
| 142 | + with: |
| 143 | + name: apt-repo |
| 144 | + path: .stage/apt-repo |
| 145 | + |
| 146 | + - name: Checkout package repo |
| 147 | + if: steps.gate.outputs.publish == 'true' |
| 148 | + uses: actions/checkout@v4 |
| 149 | + with: |
| 150 | + repository: nilstate/0state-packages |
| 151 | + token: ${{ secrets.PACKAGES_REPO_TOKEN }} |
| 152 | + path: .stage/0state-packages |
| 153 | + |
| 154 | + - name: Publish APT repository |
| 155 | + if: steps.gate.outputs.publish == 'true' |
| 156 | + env: |
| 157 | + PACKAGES_REPO_DIR: ${{ github.workspace }}/.stage/0state-packages |
| 158 | + APT_REPO_ROOT: ${{ github.workspace }}/.stage/apt-repo |
| 159 | + APT_REPO_PATH: icey |
| 160 | + run: ./scripts/publish-apt-repo.sh |
| 161 | + |
| 162 | + - name: Commit package repo update |
| 163 | + if: steps.gate.outputs.publish == 'true' |
| 164 | + run: | |
| 165 | + git -C .stage/0state-packages config user.name "github-actions[bot]" |
| 166 | + git -C .stage/0state-packages config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 167 | + if git -C .stage/0state-packages diff --quiet; then |
| 168 | + exit 0 |
| 169 | + fi |
| 170 | + git -C .stage/0state-packages add .nojekyll index.html icey |
| 171 | + git -C .stage/0state-packages commit -m "icey-server ${{ needs.build-manifests.outputs.cli_version }}" |
| 172 | + git -C .stage/0state-packages push |
| 173 | +
|
152 | 174 | publish-aur: |
153 | 175 | runs-on: ubuntu-24.04 |
154 | 176 | needs: build-manifests |
|
0 commit comments