mirror of
https://github.com/agersant/polaris
synced 2024-11-10 10:14:12 +00:00
Automate release process (#62)
Added Github Actions workflow to generate release
This commit is contained in:
parent
aec941b97f
commit
b2ee2fe701
6 changed files with 123 additions and 11 deletions
101
.github/workflows/release.yml
vendored
Normal file
101
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9]+.[0-9]+.[0-9]+**'
|
||||
|
||||
name: Release
|
||||
|
||||
jobs:
|
||||
|
||||
create_release:
|
||||
name: Create Github Release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Read Polaris Version
|
||||
run: echo ::set-env name=POLARIS_VERSION::${GITHUB_REF:10}
|
||||
- name: Create Github Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1.0.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.POLARIS_VERSION }}
|
||||
release_name: Polaris ${{ env.POLARIS_VERSION }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
- name: Write Upload URL To Disk
|
||||
run: echo "${{ steps.create_release.outputs.upload_url }}" > upload-url
|
||||
- name: Store Upload URL
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: release
|
||||
path: upload-url
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
needs: create_release
|
||||
|
||||
steps:
|
||||
- name: Checkout Polaris
|
||||
uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install Rust Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly-2020-01-01
|
||||
profile: minimal
|
||||
default: true
|
||||
- name: Read Polaris Version
|
||||
shell: bash
|
||||
run: echo ::set-env name=POLARIS_VERSION::${GITHUB_REF:10}
|
||||
- name: Build Installer
|
||||
run: res/windows/release_script
|
||||
- name: Retrieve Upload URL
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: release
|
||||
- name: Read Upload URL
|
||||
shell: bash
|
||||
run: echo ::set-env name=UPLOAD_URL::$(cat release/upload-url)
|
||||
- name: Upload Installer To Github Release
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ env.UPLOAD_URL }}
|
||||
asset_path: ./release/Polaris_${{ env.POLARIS_VERSION }}.msi
|
||||
asset_name: Polaris_${{ env.POLARIS_VERSION }}.msi
|
||||
asset_content_type: application/x-msi
|
||||
|
||||
linux:
|
||||
name: Linux
|
||||
runs-on: ubuntu-latest
|
||||
needs: create_release
|
||||
|
||||
steps:
|
||||
- name: Checkout Polaris
|
||||
uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- name: Read Polaris Version
|
||||
run: echo ::set-env name=POLARIS_VERSION::${GITHUB_REF:10}
|
||||
- name: Build Archive
|
||||
run: res/unix/release_script.sh
|
||||
- name: Retrieve Upload URL
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: release
|
||||
- name: Read Upload URL
|
||||
run: echo ::set-env name=UPLOAD_URL::$(cat release/upload-url)
|
||||
- name: Upload To Github Release
|
||||
uses: actions/upload-release-asset@v1.0.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ env.UPLOAD_URL }}
|
||||
asset_path: ./release/Polaris_${{ env.POLARIS_VERSION }}.tar.gz
|
||||
asset_name: Polaris_${{ env.POLARIS_VERSION }}.tar.gz
|
||||
asset_content_type: application/gzip
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "polaris"
|
||||
version = "0.11.0"
|
||||
version = "0.12.0-wip"
|
||||
authors = ["Antoine Gersant <antoine.gersant@lesforges.org>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
9
make_release.ps1
Normal file
9
make_release.ps1
Normal file
|
@ -0,0 +1,9 @@
|
|||
Get-ChildItem "Cargo.toml" | ForEach-Object {
|
||||
$conf = $_ | Get-Content -raw
|
||||
$conf -match 'version\s+=\s+"(.*)"' | out-null
|
||||
$script:POLARIS_VERSION = $matches[1]
|
||||
}
|
||||
|
||||
git submodule update --recursive --remote
|
||||
git tag -a $POLARIS_VERSION -m "Polaris $POLARIS_VERSION"
|
||||
git push origin $POLARIS_VERSION
|
2
build_release_unix.sh → res/unix/release_script.sh
Normal file → Executable file
2
build_release_unix.sh → res/unix/release_script.sh
Normal file → Executable file
|
@ -7,7 +7,7 @@ cp -r web docs/swagger src migrations Cargo.toml Cargo.lock res/unix/Makefile re
|
|||
|
||||
echo "Creating tarball"
|
||||
POLARIS_VERSION=$(grep -m 1 ^version Cargo.toml | awk '{print $3}' | tr -d '"\r\n')
|
||||
tar -zc -C release/tmp -f release/polaris-$POLARIS_VERSION.tar.gz polaris
|
||||
tar -zc -C release/tmp -f release/Polaris_$POLARIS_VERSION.tar.gz polaris
|
||||
|
||||
echo "Cleaning up"
|
||||
rm -rf release/tmp
|
|
@ -5,7 +5,8 @@ Get-ChildItem "Cargo.toml" | ForEach-Object {
|
|||
}
|
||||
|
||||
"Compiling resource file"
|
||||
RC /fo res\windows\application\application.res res\windows\application\application.rc
|
||||
$rc_exe = Join-Path "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64" RC.exe
|
||||
& $rc_exe /fo res\windows\application\application.res res\windows\application\application.rc
|
||||
|
||||
""
|
||||
"Compiling executable"
|
||||
|
@ -33,17 +34,18 @@ Copy-Item .\docs\swagger .\release\tmp\swagger -recurse
|
|||
|
||||
""
|
||||
"Creating installer"
|
||||
heat dir .\release\tmp\web\ -ag -g1 -dr AppDataPolaris -cg WebUI -sfrag -var wix.WebUIDir -out .\release\tmp\web_ui_fragment.wxs
|
||||
heat dir .\release\tmp\swagger\ -ag -g1 -dr AppDataPolaris -cg SwaggerUI -sfrag -var wix.SwaggerUIDir -out .\release\tmp\swagger_ui_fragment.wxs
|
||||
$heat_exe = Join-Path $env:WIX bin\heat.exe
|
||||
& $heat_exe dir .\release\tmp\web\ -ag -g1 -dr AppDataPolaris -cg WebUI -sfrag -var wix.WebUIDir -out .\release\tmp\web_ui_fragment.wxs
|
||||
& $heat_exe dir .\release\tmp\swagger\ -ag -g1 -dr AppDataPolaris -cg SwaggerUI -sfrag -var wix.SwaggerUIDir -out .\release\tmp\swagger_ui_fragment.wxs
|
||||
|
||||
candle -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\web_ui_fragment.wixobj .\release\tmp\web_ui_fragment.wxs
|
||||
candle -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\swagger_ui_fragment.wixobj .\release\tmp\swagger_ui_fragment.wxs
|
||||
candle -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\installer.wixobj .\res\windows\installer\installer.wxs
|
||||
$candle_exe = Join-Path $env:WIX bin\candle.exe
|
||||
& $candle_exe -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\web_ui_fragment.wixobj .\release\tmp\web_ui_fragment.wxs
|
||||
& $candle_exe -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\swagger_ui_fragment.wixobj .\release\tmp\swagger_ui_fragment.wxs
|
||||
& $candle_exe -wx -ext WixUtilExtension -arch x64 -out .\release\tmp\installer.wixobj .\res\windows\installer\installer.wxs
|
||||
|
||||
light -dWebUIDir=".\release\tmp\web" -dSwaggerUIDir=".\release\tmp\swagger" -wx -ext WixUtilExtension -ext WixUIExtension -spdb -sw1076 -sice:ICE38 -sice:ICE64 -out .\release\Polaris_$POLARIS_VERSION.msi .\release\tmp\installer.wixobj .\release\tmp\web_ui_fragment.wixobj .\release\tmp\swagger_ui_fragment.wixobj
|
||||
$light_exe = Join-Path $env:WIX bin\light.exe
|
||||
& $light_exe -dWebUIDir=".\release\tmp\web" -dSwaggerUIDir=".\release\tmp\swagger" -wx -ext WixUtilExtension -ext WixUIExtension -spdb -sw1076 -sice:ICE38 -sice:ICE64 -out .\release\Polaris_$POLARIS_VERSION.msi .\release\tmp\installer.wixobj .\release\tmp\web_ui_fragment.wixobj .\release\tmp\swagger_ui_fragment.wixobj
|
||||
|
||||
"Cleaning up"
|
||||
Remove-Item -Recurse .\release\tmp
|
||||
|
||||
""
|
||||
Read-Host -Prompt "All clear! Press Enter to exit"
|
Loading…
Reference in a new issue