jstime version v0.50.0 #108
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: | |
- 'v*' | |
name: Create Release | |
jobs: | |
create-github-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Release | |
run: gh release create ${{ github.ref }} --generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build assets for ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: create-github-release | |
strategy: | |
matrix: | |
name: [ | |
linux, | |
windows, | |
macos | |
] | |
include: | |
- name: linux | |
os: ubuntu-latest | |
artifact_name: jstime | |
asset_name: jstime-linux | |
asset_extension: .tar.gz | |
- name: windows | |
os: windows-latest | |
artifact_name: jstime.exe | |
asset_name: jstime-windows | |
asset_extension: .zip | |
- name: macos | |
os: macos-latest | |
artifact_name: jstime | |
asset_name: jstime-macos | |
asset_extension: .tar.gz | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set env | |
run: | | |
RELEASE_VERSION=$(echo ${GITHUB_REF:10}) | |
echo "release_version=$RELEASE_VERSION" >> $GITHUB_ENV | |
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 | |
run: gh release upload ${release_version} ${asset_name} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
publish-crate: | |
name: Publish to crates.io | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- run: cargo login ${CRATES_IO_TOKEN} | |
env: | |
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
- name: publish jstime_core | |
run: cargo publish | |
working-directory: core | |
- name: Sleep for 30 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '30s' | |
- name: publish jstime | |
run: cargo publish | |
working-directory: cli |