-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
115 additions
and
20 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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache tests | ||
id: test-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: ${{ matrix.os }}-test-cache | ||
|
||
- name: Run tests | ||
run: cargo test | ||
|
||
create_release: | ||
needs: [tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v1 | ||
- name: create release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Output Release URL File | ||
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt | ||
- name: Save Release URL File for publish | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: release_url | ||
path: release_url.txt | ||
|
||
build_and_upload: | ||
needs: [create_release] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache build | ||
id: build-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: ${{ matrix.os }}-build-cache | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Load Release URL File from release job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: release_url | ||
|
||
- name: Get Release File Name & Upload URL | ||
id: get_release_info | ||
shell: bash | ||
run: | | ||
ls -lRa | ||
value=`cat release_url/release_url.txt` | ||
echo ::set-output name=upload_url::$value | ||
- name: Upload Release Asset | ||
if: matrix.os == 'windows-latest' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | ||
asset_path: target/release/jaslog.exe | ||
asset_name: jaslog_windows.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset | ||
if: matrix.os != 'windows-latest' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | ||
asset_path: target/release/jaslog | ||
asset_name: jaslog_${{ matrix.os }} | ||
asset_content_type: application/octet-stream |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
name: Build and test | ||
name: Test | ||
|
||
on: [push] | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
tags-ignore: | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
|
@@ -12,12 +17,12 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Cache build | ||
id: build-cache | ||
- name: Cache build and tests | ||
id: build-and-test-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: target | ||
key: ${{ matrix.os }}-build-cache | ||
key: ${{ matrix.os }}-build-and-test-cache | ||
|
||
- name: Run tests | ||
run: cargo test | ||
|
@@ -45,18 +50,3 @@ jobs: | |
with: | ||
name: jaslog_windows.exe | ||
path: target/release/jaslog.exe | ||
|
||
release: | ||
if: github.ref == 'v*' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: true | ||
prerelease: false |