-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,66 +7,32 @@ jobs: | |
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
#This check is case insensitive | ||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | ||
outputs: | ||
artifactVersion: ${{ steps.setversion.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
java-version: 22 | ||
- name: Ensure to use tagged version | ||
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Output project version | ||
id: setversion | ||
run: | | ||
BUILD_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) | ||
echo "::set-output name=version::${BUILD_VERSION}" | ||
echo "version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT" | ||
- name: Build and Test | ||
run: mvn -B install | ||
- name: Upload artifact cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
path: target/cryptomator-cli-*.jar | ||
|
||
release: | ||
name: Draft a Release on GitHub Releases and uploads the build artifacts to it | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Download cryptomator-cli.jar | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
path: . | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: | | ||
:construction: Work in Progress | ||
draft: true | ||
prerelease: false | ||
- name: Upload cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar to GitHub Releases | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
asset_name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
asset_content_type: application/jar | ||
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} | ||
generate_release_notes: true | ||
draft: true |