ci: WS-279 add v2 to the dev workflow #15
Workflow file for this run
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 workflow | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
env: | |
SLACK_CHANNEL: weos | |
SLACK_USERNAME: WeOS API | |
SLACK_ICON: https://github.com/wepala.png?size=48 | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_FOOTER: copyright 2022 Wepala | |
OAUTH_TEST_KEY: ${{ secrets.OAUTH_TEST_KEY }} | |
jobs: | |
build-api: | |
name: Release Go Binaries | |
outputs: | |
today: ${{ steps.date.outputs.today }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.22.x | |
- name: Run unit tests | |
run: | | |
go test -v ./... | |
- uses: crazy-max/ghaction-xgo@v2 | |
name: build linux and mac | |
with: | |
xgo_version: latest | |
go_version: 1.22.x | |
dest: . | |
prefix: weos | |
targets: linux/386,linux/amd64,darwin/amd64,windows/386,windows/amd64 | |
v: true | |
x: false | |
race: false | |
ldflags: -s -w | |
buildmode: default | |
- name: setup app | |
run: | | |
#setup mac build | |
mkdir -p build/mac | |
cp api.yaml build/mac/api.yaml | |
cp README.md build/mac/README.md | |
cp LICENSE build/mac/LICENSE | |
cp NOTICE.txt build/mac/NOTICE.txt | |
cp weos-darwin-10.16-amd64 build/mac/weos | |
chmod +x build/mac/weos | |
tar -czf weos-mac-amd64.tar.gz -C build/mac . | |
#setup linux 32 bit build | |
mkdir -p build/linux32/apps/admin | |
cp api.yaml build/linux32/api.yaml | |
cp README.md build/linux32/README.md | |
cp LICENSE build/linux32/LICENSE | |
cp NOTICE.txt build/linux32/NOTICE.txt | |
cp weos-linux-386 build/linux32/weos | |
chmod +x build/linux32/weos | |
tar -czf weos-linux-386.tar.gz -C build/linux32 . | |
#setup linux 64 bit build | |
mkdir -p build/linux64/apps/admin | |
cp api.yaml build/linux64/api.yaml | |
cp README.md build/linux64/README.md | |
cp LICENSE build/linux64/LICENSE | |
cp NOTICE.txt build/linux64/NOTICE.txt | |
cp weos-linux-amd64 build/linux64/weos | |
chmod +x build/linux64/weos | |
tar -czf weos-linux-amd64.tar.gz -C build/linux64 . | |
#setup windows 32 bit build | |
mkdir -p build/win32/apps/admin | |
cp api.yaml build/win32/api.yaml | |
cp README.md build/win32/README.md | |
cp LICENSE build/win32/LICENSE | |
cp NOTICE.txt build/win32/NOTICE.txt | |
cp weos-windows-4.0-386.exe build/win32/weos.exe | |
chmod +x build/win32/weos.exe | |
cd build/win32 | |
zip -r ../../weos-win32.zip . | |
cd ../../ | |
#setup windows 64 bit build | |
mkdir -p build/win64/apps/admin | |
cp api.yaml build/win64/api.yaml | |
cp README.md build/win64/README.md | |
cp LICENSE build/win64/LICENSE | |
cp NOTICE.txt build/win64/NOTICE.txt | |
cp weos-windows-4.0-amd64.exe build/win64/weos.exe | |
chmod +x build/win64/weos.exe | |
cd build/win64 | |
zip -r ../../weos-win64.zip . | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
weos-linux-386.tar.gz | |
weos-linux-amd64.tar.gz | |
weos-mac-amd64.tar.gz | |
weos-win32.zip | |
weos-win64.zip | |
LICENSE | |
generate_release_notes: true | |
- name: Send release notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_COLOR: "FFFF00" | |
SLACK_MESSAGE: We were able to create a release. View the release at https://github.com/wepala/weos/releases | |
SLACK_TITLE: WeOS Build Created |