|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+' |
| 7 | + - 'v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+' |
| 8 | + - 'v[0-9]+.[0-9]+.[0-9]+-test[0-9]+' |
| 9 | +jobs: |
| 10 | + publish-pre-release: |
| 11 | + name: Publish pre-release |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Java 17 |
| 19 | + uses: actions/setup-java@v3 |
| 20 | + with: |
| 21 | + java-version: 17 |
| 22 | + distribution: temurin |
| 23 | + cache: maven |
| 24 | + server-username: NEXUS_USER |
| 25 | + server-password: NEXUS_PW |
| 26 | + gpg-private-key: ${{ secrets.BAREMAPS_GPG_SECRET_KEY }} |
| 27 | + |
| 28 | + - name: Extract variables |
| 29 | + id: variables |
| 30 | + run: | |
| 31 | + echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT |
| 32 | + echo "git_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 33 | + echo "mvn_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT |
| 34 | +
|
| 35 | + - name: Build pre-release |
| 36 | + run: mvn install -DskipTests -Dmaven.javadoc.skip=true -B -V |
| 37 | + |
| 38 | + - name: Set up GPG |
| 39 | + run: | |
| 40 | + echo "${{ secrets.BAREMAPS_GPG_SECRET_KEY }}" | gpg --batch --import |
| 41 | + gpg --list-keys |
| 42 | + env: |
| 43 | + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} |
| 44 | + |
| 45 | + - name: Sign and hash pre-release |
| 46 | + run: | |
| 47 | + cd ./baremaps-cli/target |
| 48 | + mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-src.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz |
| 49 | + shasum -a 512 "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz" > "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512" |
| 50 | + gpg --no-tty --quiet --pinentry-mode loopback --default-key "${{ secrets.GPG_KEY_ID }}" --batch --yes --output "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc" --detach-sign --armor "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz" |
| 51 | + mv apache-baremaps-${{ steps.variables.outputs.mvn_version }}-incubating-bin.tar.gz apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz |
| 52 | + shasum -a 512 "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz" > "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512" |
| 53 | + gpg --no-tty --quiet --pinentry-mode loopback --default-key "${{ secrets.GPG_KEY_ID }}" --batch --yes --output "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc" --detach-sign --armor "./apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz" |
| 54 | + cd - |
| 55 | +
|
| 56 | + - name: Publish pre-release on GitHub |
| 57 | + env: |
| 58 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + run: | |
| 60 | + gh release create "${{ steps.variables.outputs.git_tag }}" --draft --prerelease --title "Apache Baremaps ${{ steps.variables.outputs.git_version }} (incubating)" --repo ${{ github.repository }} --generate-notes |
| 61 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz |
| 62 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.sha512 |
| 63 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-src.tar.gz.asc |
| 64 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz |
| 65 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.sha512 |
| 66 | + gh release upload --clobber "${{ steps.variables.outputs.git_tag }}" ./baremaps-cli/target/apache-baremaps-${{ steps.variables.outputs.git_version }}-incubating-bin.tar.gz.asc |
0 commit comments