Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add release workflow (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy-Gonzalez authored Dec 11, 2022
1 parent 6a46a30 commit d57ae5e
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Release

on:
push:
tags: ["v*"]

jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

build:
needs: ["create-release"]
strategy:
fail-fast: false
matrix:
# https://doc.rust-lang.org/rustc/platform-support.html
# We build all the tier-1 targets at the link above. Should users need a less common target, they can always build it themselves.
include:
- label: 64-bit-windows
target: x86_64-pc-windows-msvc
runs-on: windows-latest
- label: 32-bit-windows
target: i686-pc-windows-msvc
runs-on: windows-latest
- label: 64-bit-linux
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- label: 32-bit-linux
target: i686-unknown-linux-gnu
runs-on: ubuntu-latest
- label: arm64-linux
target: aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
- label: 64-bit-macos
target: x86_64-apple-darwin
runs-on: macos-latest

name: Build (${{ matrix.target }})
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
profile: minimal

- name: Build Release
run: cargo build --release --locked --verbose
env:
CARGO_TARGET_DIR: output

- name: Create Release Archive
shell: bash
run: |
mkdir staging
if [ "${{ matrix.runs-on }}" = "windows-latest" ]; then
cp "output/release/project-evolution.exe" staging/
cd staging
7z a ../release.zip *
else
cp "output/release/project-evolution" staging/
cd staging
zip ../release.zip *
fi
- name: Prepare Asset Name
shell: bash
run: |
echo "ASSET_NAME=project-evolution-${{ github.ref_name }}-${{ matrix.label }}-${{ matrix.target }}" >> $GITHUB_ENV
- name: Upload Archive to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ env.ASSET_NAME }}.zip
asset_content_type: application/octet-stream

- name: Upload Archive as Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ASSET_NAME }}.zip
path: release.zip

0 comments on commit d57ae5e

Please sign in to comment.