fix release workflow #20
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 Builds | |
jobs: | |
create_release: | |
name: Create Release | |
runs-on: ubuntu-latest | |
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: false | |
prerelease: false | |
- name: Output Release URL | |
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt | |
- name: Publish Release URL | |
uses: actions/upload-artifact@v1 | |
with: | |
name: release_url | |
path: release_url.txt | |
build: | |
needs: [ create_release ] | |
name: Perform Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [x86_64-unknown-linux-gnu, x86_64-pc-windows-gnu] | |
include: | |
- target: x86_64-unknown-linux-gnu | |
name: linux64 | |
extension: '' | |
- target: x86_64-pc-windows-gnu | |
name: win64 | |
extension: '.exe' | |
steps: | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Build | |
run: | | |
docker build -t sulis-builder-x86_64-unknown-linux-gnu -f .github/Dockerfile-release-x86_64-unknown-linux-gnu . | |
cargo install cross | |
cross build --release --target ${{ matrix.target }} | |
mkdir sulis/ | |
cp target/${{ matrix.target }}/release/main${{ matrix.extension }} sulis/sulis${{ matrix.extension }} | |
git archive HEAD --prefix=sulis/ --format=zip -o sulis-${{ steps.get_version.outputs.VERSION }}-${{ matrix.name }}.zip | |
zip -u sulis-${{ steps.get_version.outputs.VERSION }}-${{ matrix.name }}.zip sulis/sulis${{ matrix.extension }} | |
- name: Load Release URL | |
uses: actions/download-artifact@v1 | |
with: | |
name: release_url | |
- name: Get Release URL | |
id: get_release_url | |
run: | | |
value=`cat release_url/release_url.txt` | |
echo "upload_url=$value" >> $GITHUB_OUTPUT | |
- name: Upload Asset | |
id: upload_asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_url.outputs.upload_url }} | |
asset_path: ./sulis-${{ steps.get_version.outputs.VERSION }}-${{ matrix.name }}.zip | |
asset_name: sulis-${{ steps.get_version.outputs.VERSION }}-${{ matrix.name }}.zip | |
asset_content_type: application/zip |