diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 03d3905..b6bec7a 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,28 @@ 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-${{ env.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.