Let users delete their recorded usage data #5
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| # a change to the prose or the demo cannot change what p2 would serve | |
| paths-ignore: | |
| - '**.md' | |
| - '**.adoc' | |
| - 'docs/**' | |
| - 'demo/**' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| # two dispatches must not race the gh-pages publish | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| cache: maven | |
| - name: Set up Maven 3.9.9 | |
| uses: stCarolas/setup-maven@v5 | |
| with: | |
| maven-version: '3.9.9' | |
| # The workbench tests need an X display | |
| - name: Install Xvfb | |
| run: sudo apt-get update && sudo apt-get install -y xvfb | |
| # The vogella release key, an organization secret. An unsigned site would | |
| # make p2 warn every user who installs from it, so a missing key fails the | |
| # release rather than publishing one. | |
| - name: Prepare the PGP signing key | |
| env: | |
| MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }} | |
| run: | | |
| if [ -z "$MAVEN_GPG_KEY" ]; then | |
| echo "MAVEN_GPG_KEY is not set, refusing to publish an unsigned site" >&2 | |
| exit 1 | |
| fi | |
| printf '%s\n' "$MAVEN_GPG_KEY" > "$RUNNER_TEMP/signing-key.asc" | |
| - name: Build and sign | |
| env: | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
| run: | | |
| xvfb-run -a mvn -B clean verify -Dgpg.skip=false \ | |
| -Dtycho.pgp.signer.bc.secretKeys=$RUNNER_TEMP/signing-key.asc | |
| # The directory is named after what was actually built, qualifier included, | |
| # so a rebuild of the same version never lands on an existing URL. | |
| - name: Determine the built version | |
| id: version | |
| run: | | |
| repository=org.eclipse.epp.usagedata.repository/target/repository | |
| jar=$(find "$repository/features" -name 'org.eclipse.epp.usagedata.feature_*.jar' | head -1) | |
| if [ -z "$jar" ]; then | |
| echo "No feature jar below $repository/features" >&2 | |
| exit 1 | |
| fi | |
| value=$(basename "$jar" .jar) | |
| echo "value=${value#org.eclipse.epp.usagedata.feature_}" >> "$GITHUB_OUTPUT" | |
| # A plain checkout would fail before the branch exists, so the very first | |
| # release starts the update site from an empty history instead. | |
| - name: Check out the update site | |
| run: | | |
| url="https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" | |
| git init -b gh-pages gh-pages | |
| git -C gh-pages remote add origin "$url" | |
| if git -C gh-pages fetch --depth 1 origin gh-pages; then | |
| git -C gh-pages reset --hard FETCH_HEAD | |
| fi | |
| - name: Add the build to the update site | |
| run: | | |
| version="${{ steps.version.outputs.value }}" | |
| rm -rf "gh-pages/releases/$version" | |
| mkdir -p "gh-pages/releases/$version" | |
| cp -r org.eclipse.epp.usagedata.repository/target/repository/. "gh-pages/releases/$version" | |
| # the site carries this build only; everything else is dropped. | |
| # --only rather than --keep 1, because a qualifier-named directory does | |
| # not sort above a plainly named one: 1.4.1 beats 1.4.0.202608131258. | |
| releng/update-composite-site.sh --only "$version" gh-pages | |
| - name: Publish the update site | |
| working-directory: gh-pages | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add -A | |
| git commit -m "Publish ${{ steps.version.outputs.value }}" | |
| git push origin gh-pages | |
| - name: Attach the repository archive to the release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| built=$(find org.eclipse.epp.usagedata.repository/target -maxdepth 1 -name '*.zip' | head -1) | |
| # the built name carries the Maven -SNAPSHOT suffix, which is misleading on a release | |
| archive="org.eclipse.epp.usagedata.repository-${GITHUB_REF_NAME#v}.zip" | |
| cp "$built" "$archive" | |
| gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes || true | |
| gh release upload "$GITHUB_REF_NAME" "$archive" --clobber |