Merge pull request #22 from uhryniuk/fix-concurrency #19
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
# NOTE: Depcrated pipeline, here for reference | |
name: multi-build | |
jobs: | |
create-tag-release: | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
include: | |
- name: linux-amd64 | |
runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- name: macos-amd64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- name: macos-arm64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Calculate next tag | |
id: tag_version | |
run: | | |
new_version=$(grep '^version = ' Cargo.toml | awk '{ print $3 }' | tr -d '"') | |
echo "New version: $new_version" | |
# Check if the tag already exists | |
if git rev-parse "v$new_version" >/dev/null 2>&1; then | |
echo "Tag v$new_version already exists. Exiting." | |
exit 1 | |
fi | |
# Set output for other steps | |
echo "NEW_VERSION=v$new_version" >> $GITHUB_ENV | |
echo "NEW_VERSION=v$new_version" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: "${{ matrix.target }}" | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build Binary | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Release Binary | |
shell: bash | |
run: | | |
BIN_SUFFIX="" | |
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then | |
BIN_SUFFIX=".exe" | |
fi | |
BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}" | |
BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}" | |
BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}" | |
mv "${BIN_OUTPUT}" "./<your-destination>/${BIN_RELEASE}" | |
- name: Compress artifacts | |
run: | | |
mkdir -p artifacts | |
tar -czvf artifacts/${{ matrix.target }}-build_artifacts.tar.gz -C target/${{ matrix.target }}/release . | |
- name: Create new tag | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git tag ${{ env.NEW_VERSION }} | |
git push origin ${{ env.NEW_VERSION }} | |
- name: Create GitHub Release and Upload Artifacts | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.NEW_VERSION }} | |
release_name: "Release ${{ env.NEW_VERSION }}" | |
body: "Automated release for version ${{ env.NEW_VERSION }}" | |
draft: false | |
prerelease: false | |
files: artifacts/${{ matrix.target }}-build_artifacts.tar.gz | |