Update root DB #39
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: 'Publish' | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout updated source code | |
- uses: actions/checkout@v4 | |
name: Checkout Code | |
- name: Tag | |
id: autotagger | |
uses: butlerlogic/action-autotag@stable | |
with: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
# If the new version/tag is a pre-release (i.e. 1.0.0-beta.1), create | |
# an environment variable indicating it is a prerelease. | |
- name: Pre-release | |
if: steps.autotagger.outputs.tagname != '' | |
run: | | |
if [[ "${{ steps.autotagger.output.version }}" == *"-"* ]]; then echo "::set-env IS_PRERELEASE=true";else echo "::set-env IS_PRERELEASE=''";fi | |
- name: Release | |
id: create_release | |
if: steps.autotagger.outputs.tagname != '' | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.autotagger.outputs.tagname }} | |
release_name: ${{ steps.autotagger.outputs.tagname }} | |
body: ${{ steps.autotagger.outputs.tagmessage }} | |
draft: false | |
prerelease: env.IS_PRERELEASE != '' | |
- name: Setup Go | |
if: steps.create_release.outputs.id != '' | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.21.0' # The Go version to download (if necessary) and use. | |
- uses: actions/setup-node@v3 | |
if: steps.create_release.outputs.id != '' | |
name: Setup Node.js | |
with: | |
node-version: lts/* | |
# - name: Install Quikdev Go Tool | |
# run: npm i -g @quikdev/go | |
# if: steps.create_release.outputs.id != '' | |
- name: Build Windows | |
if: steps.create_release.outputs.id != '' | |
run: | | |
name=$(grep -E '"name":' package.json | awk -F '"' '{print $4}') | |
version=$(grep -E '"version":' package.json | awk -F '"' '{print $4}') | |
description=$(grep -E '"description":' package.json | awk -F '"' '{print $4}') | |
echo "Name: $name" | |
echo "Version: $version" | |
echo "Description: $description" | |
mkdir -p ./bin/win32 | |
mkdir -p ./release | |
# qgo build | |
go build -ldflags "-X 'main.name=$name' -X 'main.version=$version' -X 'main.description=$description'" -o ./bin/win32/dh-util.exe dh-util.go | |
chmod +x ./bin/win32/dh-util.exe | |
tar -czvf ./release/dh-util-win32-x64.tar.gz ./bin/win32 | |
zip -jr ./release/dh-util-win32-x64.zip ./bin/win32 | |
env: | |
GOOS: windows | |
- name: Build macOS | |
if: steps.create_release.outputs.id != '' | |
run: | | |
name=$(grep -E '"name":' package.json | awk -F '"' '{print $4}') | |
version=$(grep -E '"version":' package.json | awk -F '"' '{print $4}') | |
description=$(grep -E '"description":' package.json | awk -F '"' '{print $4}') | |
echo "Name: $name" | |
echo "Version: $version" | |
echo "Description: $description" | |
mkdir -p ./bin/darwin | |
mkdir -p ./release | |
# qgo build | |
go build -ldflags "-X 'main.name=$PACKAGE_NAME' -X 'main.version=$PACKAGE_VERSION' -X 'main.description=$PACKAGE_DESCRIPTION'" -o ./bin/darwin/dh-util dh-util.go | |
chmod +x ./bin/darwin/dh-util | |
tar -czvf ./release/dh-util-macos-x64.tar.gz ./bin/darwin | |
zip -jr ./release/dh-util-macos-x64.zip ./bin/darwin | |
env: | |
GOOS: darwin | |
- name: Build Linux | |
if: steps.create_release.outputs.id != '' | |
run: | | |
name=$(grep -E '"name":' package.json | awk -F '"' '{print $4}') | |
version=$(grep -E '"version":' package.json | awk -F '"' '{print $4}') | |
description=$(grep -E '"description":' package.json | awk -F '"' '{print $4}') | |
echo "Name: $name" | |
echo "Version: $version" | |
echo "Description: $description" | |
mkdir -p ./bin/linux | |
mkdir -p ./release | |
# qgo build | |
go build -tags netgo -installsuffix netgo -ldflags "-X 'main.name=$name' -X 'main.version=$version' -X 'main.description=$description' -w -extldflags '-static'" -o ./bin/linux/dh-util dh-util.go | |
chmod +x ./bin/darwin/dh-util | |
tar -czvf ./release/dh-util-linux-x64.tar.gz ./bin/linux | |
zip -jr ./release/dh-util-linux-x64.zip ./bin/linux | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
# Upload tarballs to the release. | |
- name: Upload Tarball Release Artifacts | |
uses: AButler/[email protected] | |
if: steps.create_release.outputs.id != '' | |
with: | |
files: './release/*.tar.gz' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ steps.autotagger.outputs.tagname }} | |
# Upload zip files to the release. | |
- name: Upload Zip Release Artifacts | |
uses: AButler/[email protected] | |
if: steps.create_release.outputs.id != '' | |
with: | |
files: './release/*.zip' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ steps.autotagger.outputs.tagname }} | |
- name: Temp | |
run: ls -l ./release | |
- name: Rollback Release | |
if: failure() && steps.create_release.outputs.id != '' | |
uses: author/action-rollback@stable | |
with: | |
tag: ${{ steps.autotagger.outputs.tagname }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |