2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-07 09:20:31 +00:00
Alfis/.github/workflows/rust_create_release.yml

174 lines
6.5 KiB
YAML
Raw Normal View History

2021-02-23 00:48:32 +00:00
on:
2021-02-28 21:18:45 +00:00
push:
2021-03-31 11:47:56 +00:00
tags: v[0-9].[0-9]+.[0-9]+
2021-02-23 00:48:32 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
2021-02-23 15:34:49 +00:00
name: Releases
2021-02-23 00:48:32 +00:00
jobs:
2021-02-23 13:54:48 +00:00
get_version:
2021-03-31 15:22:20 +00:00
name: Get version from Git tag
2021-02-23 13:54:48 +00:00
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-03-31 11:47:56 +00:00
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $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-03-31 15:22:20 +00:00
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
2021-02-23 00:48:32 +00:00
body: |
2021-03-31 11:47:56 +00:00
## A new version
* Various fixes and stability improvements.
2021-02-23 00:48:32 +00:00
draft: true
prerelease: true
2021-02-23 15:10:12 +00:00
build-and-upload:
2021-02-23 09:44:20 +00:00
name: Create and upload builds
2021-02-23 14:36:46 +00:00
needs: [ make_release, get_version ]
2021-02-23 09:44:20 +00:00
runs-on: ${{ matrix.os }}
strategy:
matrix:
2021-02-23 15:10:12 +00:00
os: [ windows-latest, ubuntu-latest, macOS-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
cargo install cross
2021-02-23 09:55:47 +00:00
if: contains(matrix.os, 'ubuntu')
2021-03-19 13:04:41 +00:00
- name: Build release binaries
2021-02-23 00:48:32 +00:00
run: |
2021-02-23 09:44:20 +00:00
cargo build --release
2021-03-19 13:04:41 +00:00
cargo build --release --no-default-features --target-dir nogui
- name: Build Windows release binaries with Edge
if: contains(matrix.os, 'windows')
run: |
cargo build --release --features "edge" --target-dir edge
- name: Build ARMv7 binary
run: cross build --release --no-default-features --target armv7-unknown-linux-gnueabihf
if: contains(matrix.os, 'ubuntu')
2021-02-23 15:10:12 +00:00
- name: win_arch
2021-03-19 13:04:41 +00:00
run: |
echo "BIN_ARCH=windows-amd64" >> $GITHUB_ENV
echo "BIN_ARCH_NOGUI=windows-amd64-nogui" >> $GITHUB_ENV
echo "BIN_ARCH_EDGE=windows-amd64-edge" >> $GITHUB_ENV
2021-02-23 15:10:12 +00:00
if: contains(matrix.os, 'windows')
- name: lin_arch
2021-03-19 13:04:41 +00:00
run: |
echo "BIN_ARCH=linux-amd64" >> $GITHUB_ENV
echo "BIN_ARCH_NOGUI=linux-amd64-nogui" >> $GITHUB_ENV
2021-02-23 15:10:12 +00:00
if: contains(matrix.os, 'ubuntu')
- name: mac_arch
2021-03-19 13:04:41 +00:00
run: |
echo "BIN_ARCH=darwin-amd64" >> $GITHUB_ENV
echo "BIN_ARCH_NOGUI=darwin-amd64-nogui" >> $GITHUB_ENV
2021-02-23 15:10:12 +00:00
if: contains(matrix.os, 'mac')
2021-02-23 09:44:20 +00:00
- name: Fill variables
run: |
2021-02-23 10:30:29 +00:00
echo "BIN_PATH=./target/release/alfis" >> $GITHUB_ENV
2021-03-31 15:22:20 +00:00
echo "ZIP_NAME=alfis-${{env.BIN_ARCH}}-${{ needs.get_version.outputs.project_version }}.zip" >> $GITHUB_ENV
2021-03-19 13:04:41 +00:00
echo "BIN_PATH_NOGUI=./nogui/release/alfis" >> $GITHUB_ENV
2021-03-31 15:22:20 +00:00
echo "ZIP_NAME_NOGUI=alfis-${{env.BIN_ARCH}}-${{ needs.get_version.outputs.project_version }}-nogui.zip" >> $GITHUB_ENV
echo "BIN_ARM_PATH=./target/armv7-unknown-linux-gnueabihf/release/alfis" >> $GITHUB_ENV
2021-03-31 15:22:20 +00:00
echo "ZIP_ARM_NAME=alfis-armv7-${{ needs.get_version.outputs.project_version }}-nogui.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-03-31 15:22:20 +00:00
echo "ZIP_NAME=alfis-${{env.BIN_ARCH}}-${{ needs.get_version.outputs.project_version }}.zip" >> $GITHUB_ENV
2021-03-19 13:04:41 +00:00
echo "BIN_PATH_NOGUI=nogui/release/alfis.exe" >> $GITHUB_ENV
2021-03-31 15:22:20 +00:00
echo "ZIP_NAME_NOGUI=alfis-${{env.BIN_ARCH}}-${{ needs.get_version.outputs.project_version }}-nogui.zip" >> $GITHUB_ENV
2021-03-19 13:04:41 +00:00
echo "BIN_PATH_EDGE=edge/release/alfis.exe" >> $GITHUB_ENV
2021-03-31 15:22:20 +00:00
echo "ZIP_NAME_EDGE=alfis-${{env.BIN_ARCH}}-${{ needs.get_version.outputs.project_version }}-edge.zip" >> $GITHUB_ENV
2021-02-23 12:59:15 +00:00
- name: Packaging
uses: papeloto/action-zip@v1
with:
2021-03-06 23:16:22 +00:00
files: ${{ env.BIN_PATH }} alfis.toml README.md LICENSE
2021-02-23 14:36:46 +00:00
dest: ${{ env.ZIP_NAME }}
2021-03-19 13:04:41 +00:00
- name: Packaging no GUI
uses: papeloto/action-zip@v1
with:
files: ${{ env.BIN_PATH_NOGUI }} alfis.toml README.md LICENSE
dest: ${{ env.ZIP_NAME_NOGUI }}
- name: Packaging Edge binary
if: contains(matrix.os, 'windows')
uses: papeloto/action-zip@v1
with:
files: ${{ env.BIN_PATH_EDGE }} alfis.toml README.md LICENSE
dest: ${{ env.ZIP_NAME_EDGE }}
- name: Packaging ARM
uses: papeloto/action-zip@v1
with:
files: ${{ env.BIN_ARM_PATH }} alfis.toml README.md LICENSE
dest: ${{ env.ZIP_ARM_NAME }}
if: contains(matrix.os, 'ubuntu')
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 14:36:46 +00:00
asset_path: ${{ env.ZIP_NAME }}
asset_name: ${{ env.ZIP_NAME }}
2021-02-23 11:43:28 +00:00
asset_content_type: application/zip
2021-03-19 13:04:41 +00:00
- name: Upload no GUI binary
id: upload-nogui-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.make_release.outputs.upload_url }}
asset_path: ${{ env.ZIP_NAME_NOGUI }}
asset_name: ${{ env.ZIP_NAME_NOGUI }}
asset_content_type: application/zip
- name: Upload Edge binary
if: contains(matrix.os, 'windows')
id: upload-edge-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.make_release.outputs.upload_url }}
asset_path: ${{ env.ZIP_NAME_EDGE }}
asset_name: ${{ env.ZIP_NAME_EDGE }}
asset_content_type: application/zip
- name: Upload ARM binary
id: upload-arm-binary
2021-03-19 12:00:42 +00:00
if: contains(matrix.os, 'ubuntu')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.make_release.outputs.upload_url }}
asset_path: ${{ env.ZIP_ARM_NAME }}
asset_name: ${{ env.ZIP_ARM_NAME }}
asset_content_type: application/zip