One click release (#113)

* Make release from Github UI
This commit is contained in:
Antoine Gersant 2020-12-13 19:24:06 -08:00 committed by GitHub
parent 9c45ad5238
commit 847d61f62b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 35 deletions

View file

@ -1,27 +1,54 @@
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+**'
workflow_dispatch:
inputs:
versionNumber:
description: 'User-facing version number (eg: 0.13.0)'
required: true
name: Release
name: Make Release
jobs:
branch_and_tag:
name: Update Release Branch
runs-on: ubuntu-latest
steps:
- name: Merge to Release Branch
uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: release
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Release Branch
uses: actions/checkout@master
with:
ref: release
- name: Update Polaris version in Cargo.toml
run: gawk -i inplace '/^version/ { if (count == 0) { $3 = "\"${{ github.event.inputs.versionNumber }}\""; count++ } } 1' Cargo.toml
- name: Commit And Tag Changes
uses: EndBug/add-and-commit@v5
with:
branch: release
message: 'Updated version number'
tag: '${{ github.event.inputs.versionNumber }} --force'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create_release:
name: Create Github Release
runs-on: ubuntu-latest
needs: branch_and_tag
steps:
- name: Read Polaris Version
run: echo "POLARIS_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- 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 }}
tag_name: ${{ github.event.inputs.versionNumber }}
release_name: Polaris ${{ github.event.inputs.versionNumber }}
draft: true
prerelease: false
- name: Write Upload URL To Disk
@ -40,9 +67,6 @@ jobs:
steps:
- name: Checkout Polaris
uses: actions/checkout@v1
- name: Read Polaris Version
shell: bash
run: echo "POLARIS_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
@ -50,7 +74,7 @@ jobs:
- name: Make release
uses: ./.github/actions/make-windows-release
with:
version-number: ${{ env.POLARIS_VERSION }}
version-number: ${{ github.event.inputs.versionNumber }}
output-file: polaris.msi
- name: Read Upload URL
shell: bash
@ -62,7 +86,7 @@ jobs:
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: polaris.msi
asset_name: Polaris_${{ env.POLARIS_VERSION }}.msi
asset_name: Polaris_${{ github.event.inputs.versionNumber }}.msi
asset_content_type: application/x-msi
linux:
@ -73,12 +97,10 @@ jobs:
steps:
- name: Checkout Polaris
uses: actions/checkout@v1
- name: Read Polaris Version
run: echo "POLARIS_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Make release
uses: ./.github/actions/make-linux-release
with:
version-number: ${{ env.POLARIS_VERSION }}
version-number: ${{ github.event.inputs.versionNumber }}
output-file: polaris.tar.gz
- name: Retrieve Upload URL
uses: actions/download-artifact@v1
@ -93,5 +115,5 @@ jobs:
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: polaris.tar.gz
asset_name: Polaris_${{ env.POLARIS_VERSION }}.tar.gz
asset_name: Polaris_${{ github.event.inputs.versionNumber }}.tar.gz
asset_content_type: application/gzip

View file

@ -20,7 +20,7 @@ jobs:
- name: Make release
uses: ./.github/actions/make-linux-release
with:
version-number: '0.0'
version-number: '0.0.0'
output-file: polaris.tar.gz
- name: Upload packaged release
uses: actions/upload-artifact@v2
@ -104,7 +104,7 @@ jobs:
- name: Make release
uses: ./.github/actions/make-windows-release
with:
version-number: '0.0'
version-number: '0.0.0'
output-file: polaris.msi
- name: Upload packaged release
uses: actions/upload-artifact@v2

2
Cargo.lock generated
View file

@ -1394,7 +1394,7 @@ dependencies = [
[[package]]
name = "polaris"
version = "0.12.4"
version = "0.0.0"
dependencies = [
"anyhow",
"ape",

View file

@ -1,6 +1,6 @@
[package]
name = "polaris"
version = "0.12.4"
version = "0.0.0"
authors = ["Antoine Gersant <antoine.gersant@lesforges.org>"]
edition = "2018"

View file

@ -1,10 +1,10 @@
# Maintenance
## How to make a release
- `git pull` to not miss out on any recent contributions
- Update version number in Cargo.toml and commit the change (no need to push)
- Run `make_release.ps1`
- On Github, go to **Actions**, select the **Make Release** workflow and click **Run workflow**
- Select the branch to deploy (usually `master`)
- Input a user-facing version name (eg: **0.13.0**)
- Click the **Run workflow** button
- After CI completes, find the release on Github and write the changelog
- Move the release from Draft to Published

View file

@ -1,10 +0,0 @@
Get-ChildItem "Cargo.toml" | ForEach-Object {
$conf = $_ | Get-Content -raw
$conf -match 'version\s+=\s+"(.*)"' | out-null
$script:POLARIS_VERSION = $matches[1]
}
git tag -d $POLARIS_VERSION
git push --delete origin $POLARIS_VERSION
git tag $POLARIS_VERSION
git push --tags