From 686183f8ccf6671d1925e987683d99991aea47c5 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Fri, 9 Aug 2024 11:40:18 +0200 Subject: [PATCH 1/2] ci: Simplify release process by generating artifacts in the CI --- .github/workflows/maven.yml | 26 ++++++++++++++++++++++++++ README.md | 3 +-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 03d3905..599c69e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -8,6 +8,8 @@ on: branches: [ master ] pull_request: branches: [ master ] + release: + types: [created] jobs: build: @@ -22,5 +24,29 @@ jobs: java-version: '11' distribution: 'temurin' cache: maven + - name: Build with Maven run: mvn -B package + + - name: Get release upload URL + id: get_release_upload_url + if: github.event_name == 'release' + uses: bruceadams/get-release@v1.3.2 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Extract version string + id: version_string_variable + run: echo "VERSION_STRING=$(mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Upload release asset + id: upload-release-asset + if: github.event_name == 'release' + uses: shogo82148/actions-upload-release-asset@v1.7.5 + with: + upload_url: ${{ steps.get_release_upload_url.outputs.upload_url }} + asset_path: ./target/openrefine-commons.zip + asset_name: openrefine-commons-$VERSION_STRING.zip + asset_content_type: application/zip + + diff --git a/README.md b/README.md index adcb28f..1da17e7 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,6 @@ To avoid having to unzip the extension in the corresponding directory every time - Commit and push those changes to master - Add a corresponding git tag, with `git tag -a v0.1.0 -m "Version 0.1.0"` (when working from GitHub Desktop, you can follow [this process](https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/managing-tags) and manually add the `v0.1.0` tag with the description `Version 0.1.0`) - Push the tag to GitHub: `git push --tags` (in GitHub Desktop, just push again) -- Create the zip file for the release: `mvn package` -- Create a new release on GitHub at https://github.com/OpenRefine/CommonsExtension/releases/new, providing a release title (such as "Commons extension 0.1.0") and a description of the features in this release. Upload the zip file you generated at the previous step as an attachment (it can be found in the `target` subfolder of your local copy of the repository). +- Create a new release on GitHub at https://github.com/OpenRefine/CommonsExtension/releases/new, providing a release title (such as "Commons extension 0.1.0") and a description of the features in this release. - Open `pom.xml` and set the version to the expected next version number, followed by `-SNAPSHOT`. For instance, if you just released 0.1.0, you could set `0.1.1-SNAPSHOT` - Commit and push those changes. From de2df9aec2eaa11fd7dec539bbfb1374e1966ff3 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Tue, 10 Sep 2024 14:01:04 +0200 Subject: [PATCH 2/2] fix version string inclusion --- .github/workflows/maven.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 599c69e..b6bec7a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -46,7 +46,6 @@ jobs: with: upload_url: ${{ steps.get_release_upload_url.outputs.upload_url }} asset_path: ./target/openrefine-commons.zip - asset_name: openrefine-commons-$VERSION_STRING.zip + asset_name: openrefine-commons-${{ env.VERSION_STRING }}.zip asset_content_type: application/zip - - +