Skip to content

Commit

Permalink
chore(ci) The publish_jar job needs code etc. Merge it with test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed May 5, 2020
1 parent 210c1e5 commit cb6cb17
Showing 1 changed file with 32 additions and 50 deletions.
82 changes: 32 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,38 @@ on:
- '**'

jobs:
test:
name: Test
create_pre_release:
name: Create pre-release

runs-on: ubuntu-latest

steps:
# The pre-release must be created only once, hence the split
# into multiple jobs with different `strategy`.
- name: Create a Github pre-release
id: create_pre_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: true

- name: Output `release_url` into a temporary file
run: echo "${{ steps.create_pre_release.outputs.upload_url }}" > release_url.txt

- name: Save the `release_url` temporary file
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt

publish_jar:
name: Publish the JARs

needs: [create_pre_release]

strategy:
matrix:
Expand Down Expand Up @@ -61,54 +91,6 @@ jobs:
export PATH="$HOME/.cargo/bin:$PATH"
make test
create_pre_release:
name: Release

needs: [test]

runs-on: ubuntu-latest

steps:
# The pre-release must be created only once, hence the split
# into multiple jobs with different `strategy`.
- name: Create a Github pre-release
id: create_pre_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: true

- name: Output `release_url` into a temporary file
run: echo "${{ steps.create_pre_release.outputs.upload_url }}" > release_url.txt

- name: Save the `release_url` temporary file
uses: actions/upload-artifact@v1
with:
name: release_url
path: release_url.txt

publish_jar:
name: Publish the JARs

needs: [create_pre_release]

strategy:
matrix:
# The job runs on 3 different OS.
os: [ubuntu-latest, macos-latest, windows-latest]
# The job runs on different Java versions (LTS).
java: [8]
# As soon as one job fails in the matrix, all the other
# in-progress jobs are canceled.
fail-fast: true

runs-on: ${{ matrix.os }}

steps:
- name: Create the JAR
id: create_jar
shell: bash
Expand Down

0 comments on commit cb6cb17

Please sign in to comment.