feature(workflow) update branch dependency #65
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: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
- feat/* | |
- release-integration/official-web | |
tags: | |
- v* | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
goos: [linux, darwin, windows] | |
goarch: [amd64, arm64] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go environment | |
uses: actions/setup-go@v5.0.0 | |
with: | |
go-version: stable | |
- name: Build | |
env: | |
CGO_ENABLED: 0 | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: | | |
VERSION=$([[ ! -z $GITHUB_REF_NAME ]] && echo $GITHUB_REF_NAME || echo $GITHUB_HEAD_NAME) | |
echo "Raiden version: $VERSION" | |
sed -i "s,.*appVersion = \".*\"$,\tappVersion = \"$VERSION\"," 'cmd/raiden/commands/version.go' | |
go build -ldflags="-s -w" -trimpath -o build/raiden ./cmd/raiden/main.go | |
cd build | |
if [[ $GOOS == 'darwin' ]]; then | |
cp raiden raiden-macos-"$GOARCH" | |
sha256sum -b raiden-macos-"$GOARCH" > raiden-macos-"$GOARCH".sha256 | |
elif [[ $GOOS == 'windows' ]]; then | |
mv raiden raiden.exe | |
sudo apt-get install -y nsis | |
makensis -NOCD -DARCH="$GOARCH" ${GITHUB_WORKSPACE}/scripts/windows.nsi | |
sha256sum -b raiden-"$GOOS"-"$GOARCH"-setup.exe > raiden-"$GOOS"-"$GOARCH"-setup.exe.sha256 | |
else | |
cp raiden raiden-"$GOOS"-"$GOARCH" | |
sha256sum -b raiden-"$GOOS"-"$GOARCH" > raiden-"$GOOS"-"$GOARCH".sha256 | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: build/raiden-* | |
make_latest: true | |
generate_release_notes: true | |
push-version: | |
needs: build-and-release | |
runs-on: ubuntu-latest | |
if: success() | |
steps: | |
- name: Checkout target repo | |
run: | | |
git clone https://$GITHUB_USER:$GITHUB_TOKEN@github.com/sev-2/docs.git docs | |
- name: Write JSON file | |
run: | | |
echo "{\"version\": \"$GITHUB_REF_NAME\"}" > docs/public/latest.json | |
- name: Commit and push changes | |
run: | | |
cd docs | |
git config --global user.name "raiden-ci" | |
git config --global user.email "raiden-ci@sev-2.com" | |
git remote set-url origin https://$GITHUB_USER:$GITHUB_TOKEN@github.com/sev-2/docs.git | |
git add . | |
git commit -m "Update to version $GITHUB_REF_NAME" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.TARGET_REPO_TOKEN }} | |
GITHUB_USER: ${{ secrets.TARGET_USERNAME }} |