2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-03 15:40:19 +00:00
Alfis/.github/workflows/rust_create_release.yml

91 lines
2.6 KiB
YAML
Raw Normal View History

2021-02-23 00:48:32 +00:00
on:
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
name: Create release
jobs:
2021-02-23 13:54:48 +00:00
get_version:
name: Get version from Cargo.toml
runs-on: ubuntu-latest
outputs:
2021-02-23 14:02:56 +00:00
project_version: ${{ env.VERSION }}
2021-02-23 13:54:48 +00:00
steps:
2021-02-23 14:02:56 +00:00
- name: Checkout code
2021-02-23 13:54:48 +00:00
uses: actions/checkout@v2
2021-02-23 14:02:56 +00:00
- name: Getting version
2021-02-23 13:54:48 +00:00
run: |
2021-02-23 14:07:33 +00:00
echo "VERSION=$(cat Cargo.toml | grep version | sed s/version//g | sed s/=//g | sed s/\"//g | sed s/\ //g | sed -n 1p)" >> $GITHUB_ENV
2021-02-23 13:54:48 +00:00
2021-02-23 00:48:32 +00:00
make_release:
name: Create Release
runs-on: ubuntu-latest
2021-02-23 13:54:48 +00:00
needs: get_version
2021-02-23 09:44:20 +00:00
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2021-02-23 00:48:32 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
2021-02-23 13:54:48 +00:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-02-23 14:07:33 +00:00
VERSION: ${{ needs.get_version.outputs.project_version }}
2021-02-23 00:48:32 +00:00
with:
2021-02-23 13:54:48 +00:00
tag_name: v${{ env.VERSION }}
release_name: Test version v${{ env.VERSION }}
2021-02-23 00:48:32 +00:00
body: |
Changes in this version
To be written by maintainer.
draft: true
prerelease: true
2021-02-23 09:44:20 +00:00
upload:
name: Create and upload builds
2021-02-23 11:06:16 +00:00
needs: make_release
2021-02-23 09:44:20 +00:00
runs-on: ${{ matrix.os }}
strategy:
matrix:
2021-02-23 11:43:28 +00:00
os: [ windows-latest ]
2021-02-23 01:06:35 +00:00
defaults:
run:
shell: bash
2021-02-23 00:48:32 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v2
2021-02-23 09:55:47 +00:00
- name: install libgtk-dev libwebkit2gtk-4.0
run: sudo apt update && sudo apt install libwebkit2gtk-4.0-dev
if: contains(matrix.os, 'ubuntu')
2021-02-23 00:48:32 +00:00
- name: Build release binary
run: |
2021-02-23 09:44:20 +00:00
cargo build --release
- name: Fill variables
run: |
2021-02-23 10:30:29 +00:00
echo "BIN_PATH=./target/release/alfis" >> $GITHUB_ENV
2021-02-23 14:15:07 +00:00
echo "BIN_NAME=alfis_${{env.VERSION}}.zip" >> $GITHUB_ENV
2021-02-23 09:44:20 +00:00
- name: Windows variables
if: contains(matrix.os, 'windows')
run: |
2021-02-23 12:59:15 +00:00
echo "BIN_PATH=target/release/alfis.exe" >> $GITHUB_ENV
2021-02-23 14:15:07 +00:00
echo "BIN_NAME=alfis_${{env.VERSION}}.zip" >> $GITHUB_ENV
2021-02-23 12:59:15 +00:00
- name: Packaging
uses: papeloto/action-zip@v1
with:
files: ${{ env.BIN_PATH }}
dest: ${{ env.BIN_NAME }}
2021-02-23 09:44:20 +00:00
- name: Upload binary
id: upload-binary
2021-02-23 00:48:32 +00:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2021-02-23 11:06:16 +00:00
upload_url: ${{ needs.make_release.outputs.upload_url }}
2021-02-23 12:59:15 +00:00
asset_path: ${{ env.BIN_NAME }}
2021-02-23 10:30:29 +00:00
asset_name: ${{ env.BIN_NAME }}
2021-02-23 11:43:28 +00:00
asset_content_type: application/zip