test-and-learn compute release version #3
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Build Release version based on prepare-XXX branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "prepare-*" ] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Compute Release Version | |
id: compute-version | |
run: | | |
$env:RELEASE_VERSION = '${{ github.ref_name }}'.Trim().Replace('prepare-', '') | |
echo "CELLS_RELEASE=$env:RELEASE_VERSION" >> $env:GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
# - name: Fake Build UX (just create build folder) | |
# run: mkdir -p app/ux/build; touch app/ux/build/index.html | |
- name: Setup Node | |
uses: actions/setup-node@v2.5.2 | |
with: | |
node-version: v16 | |
- name: Npm Install | |
run: npm install | |
working-directory: app/ux | |
- name: NPM Build | |
run: | | |
$env:CI=false | |
npm run build | |
working-directory: app/ux | |
- name: Build Main | |
run: | | |
$env:CGO_CXXFLAGS="-I${{github.workspace}}\libs\webview2\build\native\include" | |
go build -a -trimpath -ldflags "-H=windowsgui -X github.com/pydio/cells-sync/common.Version=${{ steps.compute-version.outputs.CELLS_RELEASE }}" -o cells-sync.exe | |
- name: Build No-UI Version | |
run: | | |
$env:CGO_ENABLED=0 | |
go build -a -trimpath --tags pure -ldflags "-X github.com/pydio/cells-sync/common.Version=${{ steps.compute-version.outputs.CELLS_RELEASE }}" -o cells-sync-noui.exe | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cells-sync-windows | |
path: cells-sync*.exe | |
- name: Checkout Artifacts | |
uses: actions/checkout@v4 | |
with: | |
ref: artifacts-prepare | |
path: artifacts | |
- name: Notify branch | |
run: | | |
echo ${{ steps.compute-version.outputs.CELLS_RELEASE }} > release-version | |
echo '{"run_id":"${{ github.run_id }}", "run_number":"${{ github.run_number }}", "run_attempt":"${{ github.run_attempt }}", "sha":"${{ github.sha }}"}' > latest.json | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "regenerated latest file" | |
git push | |
working-directory: artifacts |