Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
* remove/replace deprecated actions
* update remaining actions to latest version
  • Loading branch information
infeo committed Mar 12, 2024
1 parent fc9101c commit 183f4d2
Showing 1 changed file with 20 additions and 56 deletions.
76 changes: 20 additions & 56 deletions .github/workflows/buildAndRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Build
on:
[push]

env:
APP_NAME: reverseCharger

jobs:
build:
name: Build and Test
Expand All @@ -14,26 +11,14 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" #This check is case insensitive
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'maven'
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Use a numerical verison for jpackage
shell: pwsh
run: |
$numVer = (mvn help:evaluate '-Dexpression=project.version' '-q' '-DforceStdout') -replace '(\d{1,3}\.\d{1,3}\.\d{1,3})(.*)' ,'$1'
mvn versions:set --file pom.xml "-DnewVersion=${numVer}"
- name: Extract version from tag and set it as project version
if: startsWith(github.ref, 'refs/tags/')
shell: bash
Expand All @@ -42,9 +27,9 @@ jobs:
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Uploads the build artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{env.APP_NAME}}-${{runner.os}}.zip
name: ${{runner.os}}.zip
path: target/reverseCharger-*.zip

release:
Expand All @@ -58,43 +43,22 @@ jobs:
- name: Get version from tag and set up environment
run: echo "BUILD_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v2
- 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 linux package to release draft
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/download-artifact@v4
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-Linux.zip/reverseCharger-${{ env.BUILD_VERSION }}-linux.zip
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-linux.zip
asset_content_type: application/gzip
- name: Upload windows artifact to release draft
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
merge-multiple: true
- name: Draft a release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-Windows.zip/reverseCharger-${{ env.BUILD_VERSION }}-win.zip
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-win.zip
asset_content_type: application/zip
- name: Upload mac artifact to release draft
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
discussion_category_name: releases
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
draft: true
generate_release_notes: true
body: |-
:construction: Work in Progress
- name: Publish build artifacts on release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.APP_NAME }}-macOS.zip/reverseCharger-${{ env.BUILD_VERSION }}-mac.zip
asset_name: ${{ env.APP_NAME }}-${{ env.BUILD_VERSION }}-mac.zip
asset_content_type: application/zip
fail_on_unmatched_files: true
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
files: |
reverseCharger-*.zip

0 comments on commit 183f4d2

Please sign in to comment.