0.2.21 #60
Workflow file for this run
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
on: | |
push: | |
tags: '*' | |
name: Create Release | |
jobs: | |
publish-crate: | |
name: Publish to crates.io | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Setup Chomp | |
with: | |
version: 0.2.11 | |
uses: guybedford/chomp-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- run: cargo login ${CRATES_IO_TOKEN} | |
env: | |
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
- run: chomp build:release | |
- name: publish chomp | |
run: cargo publish | |
create-github-release: | |
name: Create GitHub Release | |
needs: publish-crate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release Notes | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
await github.request(`POST /repos/${{ github.repository }}/releases`, { | |
tag_name: "${{ github.ref }}", | |
generate_release_notes: true | |
}); | |
build: | |
name: Build assets for ${{ matrix.os }} | |
needs: create-github-release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
name: [ | |
linux, | |
windows, | |
macos | |
] | |
include: | |
- name: linux | |
os: ubuntu-latest | |
artifact_name: chomp | |
asset_name: chomp-linux | |
asset_extension: .tar.gz | |
- name: windows | |
os: windows-latest | |
artifact_name: chomp.exe | |
asset_name: chomp-windows | |
asset_extension: .zip | |
- name: macos | |
os: macos-latest | |
artifact_name: chomp | |
asset_name: chomp-macos | |
asset_extension: .tar.gz | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set env | |
run: | | |
RELEASE_VERSION=$(echo ${GITHUB_REF:10}) | |
echo "asset_name=${{ matrix.asset_name }}-${RELEASE_VERSION}${{ matrix.asset_extension }}" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Build | |
run: cargo build --release --locked | |
- name: Archive release | |
shell: bash | |
run: | | |
cp "target/release/${{ matrix.artifact_name }}" "${{ matrix.artifact_name }}" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "${asset_name}" "${{ matrix.artifact_name }}" | |
else | |
tar czf "${asset_name}" "${{ matrix.artifact_name }}" | |
fi | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v1-release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: chomp*${{ matrix.asset_extension }} | |
file_glob: true | |
tag: ${{ github.ref }} |