Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sunwu51 authored Apr 21, 2024
1 parent 2aa1ddc commit 7b96f35
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,37 @@ on:
- 'v*'

jobs:
build:
name: Build and Release
build-java:
name: Build Java
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, darwin, linux]
goarch: [arm64, amd64]
steps:
- uses: actions/checkout@v3

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'

- name: Build Java with Maven
run: |
mvn package
shell: bash

- name: Upload Jar
uses: actions/upload-artifact@v3
with:
name: swapper.jar
path: target/swapper-0.0.1-SNAPSHOT.jar
build-go:
name: Build Go
runs-on: ubuntu-latest
strategy:
matrix:
goos: [windows, darwin, linux]
goarch: [arm64, amd64]
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '^1.22'

- name: Build Go Binary
working-directory: ./jbs-client
run: |
Expand All @@ -43,26 +48,23 @@ jobs:
fi
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -v -o jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}$EXT
shell: bash

- name: Archive Production Artifacts
run: |
zip -r release-${{ matrix.goos }}-${{ matrix.goarch }}.zip target/*.jar jbs-client/jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}*
zip -r jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}.zip jbs-client/jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}*
shell: bash

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}.zip
path: release-${{ matrix.goos }}-${{ matrix.goarch }}.zip
name: jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}.zip
path: jbs-client-${{ matrix.goos }}-${{ matrix.goarch }}.zip

release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
needs: ["build-java", "build-go"]
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -73,14 +75,12 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dir: ${{ github.repository }}
run: |
cd $dir
for zipfile in *.zip; do
cd JVMByteSwapTool
for zipfile in *; do
if [[ -f "$zipfile" ]]; then
echo "Uploading $zipfile"
curl \
Expand Down

0 comments on commit 7b96f35

Please sign in to comment.