Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade travis and appveyor to github action #3416

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/build-release-binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Release Bitshares-ui

on:
push:
tags:
- "*.*.*"
# branches: [testaction]

jobs:
build:
runs-on: macOS-latest

strategy:
matrix:
node-version: [16.13.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: echo "PackageVersion=$(cat package.json | sed 's/,/\n/g' | grep '\"version\":' | sed 's/:/\n/g' | sed '1d' | sed 's/ //g' | sed 's/\"//g' | sed 's/}//g')" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, these long lines look ugly when viewing Github.com in a web browser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be optimized here, such as using jq, but I don't want to use too many external programs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commands can be simply wrapped with the \ sign and etc. Actually, since you have ( in the command, it supports multiple lines by itself already. E.G.

- run: |
    echo "PackageVersion=$(cat package.json | sed 's/,/\n/g' | grep '\"version\":' |
        sed 's/:/\n/g' | sed '1d' | sed 's/ //g' | sed 's/\"//g' | sed 's/}//g')" \
        >> $GITHUB_ENV

Just my 2 cents.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this is not the only long line in the pull request. It's best to wrap them all.

- name: Update package.json
run: |
sed -i -e "s/${{ env.PackageVersion }}/${{ github.ref_name }}/g" package.json
- run: yarn
- name: Build package
run: npm run prepackage
- name: Build dmg
run: ./node_modules/.bin/electron-builder -p never --mac dmg
- name: Build deb
run: ./node_modules/.bin/electron-builder -p never --linux deb
- name: Build exe
run: ./node_modules/.bin/electron-builder -p never --windows
- name: Calc hash
id: calc_hash
run: |
echo "::set-output name=dmghash::${{ hashFiles('build/binaries/**.dmg') }}"
echo "::set-output name=debhash::${{ hashFiles('build/binaries/**.deb') }}"
echo "::set-output name=exehash::${{ hashFiles('build/binaries/**.exe') }}"
- name: Create Body
id: create_body
uses: xiangxn/generate_release_notes@v1
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
categories: |
[{"title":"New features","labels":["feature","enhancement"]},{"title":"Bug fixes and improvements","labels":["bug","bugfix"]}]
template: |
Release Notes
_________________________________

$CHANGES

Binaries for download
--------
| Platform | SHA256 Checksum |
|---|---|
|[Microsoft Windows](https://github.com/bitshares/bitshares-ui/releases/download/${{ github.ref_name }}/BitShares_${{ github.ref_name }}.exe)|`${{steps.calc_hash.outputs.exehash}}`|
|[Mac](https://github.com/bitshares/bitshares-ui/releases/download/${{ github.ref_name }}/BitShares_${{ github.ref_name }}.dmg)|`${{steps.calc_hash.outputs.dmghash}}`|
|[Linux](https://github.com/bitshares/bitshares-ui/releases/download/${{ github.ref_name }}/BitShares_${{ github.ref_name }}.deb)|`${{steps.calc_hash.outputs.debhash}}`|
- name: Create Release
id: create_release
uses: actions/[email protected]
sschiessl-bcp marked this conversation as resolved.
Show resolved Hide resolved
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_name: Release ${{ github.ref_name }}
body: ${{ steps.create_body.outputs.body }}
draft: true
- name: Upload dmg
uses: actions/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/binaries/BitShares_${{ github.ref_name }}.dmg
asset_name: BitShares_${{ github.ref_name }}.dmg
asset_content_type: application/octet-stream
- name: Upload deb
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/binaries/BitShares_${{ github.ref_name }}.deb
asset_name: BitShares_${{ github.ref_name }}.deb
asset_content_type: application/x-deb
- name: Upload exe
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/binaries/BitShares_${{ github.ref_name }}.exe
asset_name: BitShares_${{ github.ref_name }}.exe
asset_content_type: application/octet-stream