-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update release workflow in GitHub Actions (#208)
* - **FIX** Simplified release workflow - **CHANGED** Read CHANGELOG.md when creating a release - **CHANGED** Automatically detect pre-release base on tag name (-preX suffix) * use matrix to build and upload artifacts * fix dependency * cleanup * fix matrix * use env.GITHUB_REF_NAME * one more try with GITHUB_REF_NAME * echo github.ref.name * disable stuff for faster turnaround * use include tag * re-enable all code * fix tag name * read part of changelog * typo * use environment variable to propagate changelog * extract changelog to temp file * typo again * re-enable validation steps
- Loading branch information
1 parent
bcb0278
commit a0af5de
Showing
2 changed files
with
79 additions
and
97 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,26 @@ on: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
build-linux: | ||
|
||
runs-on: ubuntu-18.04 | ||
build: | ||
name: Build & Upload | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-18.04 | ||
target: "./cmd/longtail/longtail" | ||
platform: linux | ||
tag: "${GITHUB_REF_NAME}" | ||
- os: macos-latest | ||
target: "./cmd/longtail/longtail" | ||
platform: macos | ||
tag: "${GITHUB_REF_NAME}" | ||
- os: windows-latest | ||
target: "./cmd/longtail/longtail.exe" | ||
platform: win32 | ||
tag: "${env:GITHUB_REF_NAME}" | ||
|
||
runs-on: ${{matrix.os}} | ||
|
||
steps: | ||
- name: Set up Go 1.17.1 | ||
|
@@ -20,157 +37,106 @@ jobs: | |
- name: Check out source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: build cmd | ||
- name: Build | ||
run: | | ||
pushd ./cmd/longtail | ||
GITHUB_FULLREF=${{ github.ref }} | ||
RELEASE_VERSION=${GITHUB_FULLREF#refs/*/} | ||
echo Version $RELEASE_VERSION | ||
go build -ldflags="-s -w -X 'github.com/DanEngelbrecht/golongtail/commands.BuildVersion=${RELEASE_VERSION}'" . | ||
echo matrix.tag ${{ matrix.tag }} | ||
go build -ldflags="-s -w -X 'github.com/DanEngelbrecht/golongtail/commands.BuildVersion=${{ matrix.tag }}'" . | ||
popd | ||
- name: build dist | ||
run: | | ||
mkdir dist | ||
cp ./cmd/longtail/longtail dist/ | ||
cp ${{matrix.target}} dist/ | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: dist-linux-x64 | ||
path: dist | ||
|
||
build-macos: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Set up Go 1.17.1 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.17.1 | ||
|
||
- name: Check out source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: build cmd | ||
run: | | ||
pushd ./cmd/longtail | ||
GITHUB_FULLREF=${{ github.ref }} | ||
RELEASE_VERSION=${GITHUB_FULLREF#refs/*/} | ||
echo Version $RELEASE_VERSION | ||
go build -ldflags="-s -w -X 'github.com/DanEngelbrecht/golongtail/commands.BuildVersion=${RELEASE_VERSION}'" . | ||
popd | ||
- name: build dist | ||
run: | | ||
mkdir dist | ||
cp ./cmd/longtail/longtail dist/ | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: dist-macos-x64 | ||
path: dist | ||
|
||
build-win32: | ||
|
||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Set up Go 1.17.1 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.17.1 | ||
|
||
- name: Check out source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: build cmd | ||
run: | | ||
pushd ./cmd/longtail | ||
$GITHUB_FULLREF="${{ github.ref }}" | ||
$RELEASE_VERSION=$GITHUB_FULLREF -replace 'refs/.*/', '' | ||
echo Version $RELEASE_VERSION | ||
go build -ldflags="-s -w -X 'github.com/DanEngelbrecht/golongtail/commands.BuildVersion=${RELEASE_VERSION}'" . | ||
popd | ||
- name: build dist | ||
run: | | ||
mkdir dist | ||
cp ./cmd/longtail/longtail.exe dist/ | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: dist-win32-x64 | ||
name: dist-${{matrix.platform}}-x64 | ||
path: dist | ||
|
||
create-release: | ||
|
||
runs-on: ubuntu-18.04 | ||
|
||
needs: [build-linux, build-macos, build-win32] | ||
needs: [build] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ github.ref }} | ||
name: Release ${{ github.ref }} | ||
body: | | ||
Changes in this Release | ||
- **CHANGED** set block extension to ".lsb" for fsblockstore in remote stores | ||
- **UPDATED** Updated longtail to 0.3.3 | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Download Linux artifacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: dist-linux-x64 | ||
path: dist-linux-x64 | ||
|
||
- name: Download MacOs artifacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: dist-macos-x64 | ||
path: dist-macos-x64 | ||
|
||
- name: Download Win32 artifacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: dist-win32-x64 | ||
path: dist-win32-x64 | ||
|
||
- name: rename artifacts | ||
- name: Rename artifacts | ||
run: | | ||
cp dist-linux-x64/longtail longtail-linux-x64 | ||
cp dist-macos-x64/longtail longtail-macos-x64 | ||
cp dist-win32-x64/longtail.exe longtail-win32-x64.exe | ||
- name: Zip Linux artifacts | ||
uses: montudor/[email protected] | ||
with: | ||
args: zip -qq -r ./linux-x64.zip ./dist-linux-x64 | ||
|
||
- name: Zip MacOS artifacts | ||
uses: montudor/[email protected] | ||
with: | ||
args: zip -qq -r ./macos-x64.zip ./dist-macos-x64 | ||
|
||
- name: Zip Win32 artifacts | ||
uses: montudor/[email protected] | ||
with: | ||
args: zip -qq -r ./win32-x64.zip ./dist-win32-x64 | ||
- name: Upload to GitHub release | ||
uses: Roang-zero1/github-upload-release-artifacts-action@master | ||
|
||
- name: Check prerelease | ||
id: get-prerelease | ||
uses: haya14busa/action-cond@v1 | ||
with: | ||
args: | | ||
cond: ${{contains(github.ref, '-pre')}} | ||
if_true: "true" | ||
if_false: "false" | ||
|
||
- name: Extract Version Changes | ||
run: | | ||
sed '1,/^##/!d;/##/d' CHANGELOG.md > CHANGELOG.tmp | ||
- name: Read CHANGELOG.tmp | ||
id: read_changelog | ||
uses: andstor/file-reader-action@v1 | ||
with: | ||
path: "CHANGELOG.tmp" | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{github.ref.name}} | ||
body: | | ||
${{steps.read_changelog.outputs.contents}} | ||
draft: false | ||
prerelease: ${{steps.get-prerelease.outputs.value}} | ||
files: | | ||
win32-x64.zip | ||
linux-x64.zip | ||
macos-x64.zip | ||
longtail-linux-x64 | ||
longtail-macos-x64 | ||
longtail-win32-x64.exe | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## | ||
- **UPDATED** Update all Go dependencies to latest version | ||
- **FIX** Simplified release workflow | ||
- **CHANGED** Read CHANGELOG.md when creating a release | ||
- **CHANGED** Automatically detect pre-release base on tag name (-preX suffix) | ||
|
||
## v0.3.3 | ||
- **CHANGED** set block extension to ".lsb" for fsblockstore in remote stores | ||
- **UPDATED** Updated longtail to 0.3.3 | ||
|
||
## v0.3.2 | ||
- **ADDED** `put` commmand to complement `get` commmand | ||
- **CHANGED** `--get-config-path` option has been removed from `upsync`; use `put` instead. | ||
- **CHANGED** `--get-config-path` option for `get` renamed to `--source-path` | ||
- **FIXED** Automatic resolving of `--target-path` for `downsync` and `get` now resolves to a folder in the local directory | ||
- **UPDATED** Updated longtail to 0.3.2 |