Skip to content

Merge branch 'release/v3.17.5' of ssh://github.com/g-research/fasttra… #3

Merge branch 'release/v3.17.5' of ssh://github.com/g-research/fasttra…

Merge branch 'release/v3.17.5' of ssh://github.com/g-research/fasttra… #3

Workflow file for this run

name: Build and push UI
on:
pull_request:
branches:
- release/v*
push:
branches:
- release/v*
jobs:
version:
name: Compute Go module version
runs-on: ubuntu-latest
outputs:
count: ${{ steps.version.outputs.count }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
# We count the number of commits since the initial import of the upstream repo
# and use that as the patch version of the Go module.
# The minor version is upstream version formatted as increasing integer.
- name: Compute Go module version
id: version
run: |
start=$(git log --pretty=format:%H -- src/package.json | tail -n 1)
count=$(git rev-list --count $start..HEAD)
echo "Count: $count"
echo "count=${count}" >> "$GITHUB_OUTPUT"
if [ "${{ github.event_name }}" == "push" ]; then
IFS='.' read -r -a semver <<< "${GITHUB_REF/refs\/heads\/release\/v/}"
version=0.$(printf "%d%02d%02d" ${semver[@]}).$count
echo "Version: $version"
echo "version=${version}" >> "$GITHUB_OUTPUT"
fi
build:
name: Build UI
# We only build the UI if we are on a pull request or if we are on a push that
# is not the initial import (count > 0).
if: github.event_name == 'pull_request' || (github.event_name == 'push' && fromJSON(needs.version.outputs.count) > 0)
needs: version
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
cache: false
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Run Dagger pipeline
working-directory: builder
run: go run main.go
env:
_EXPERIMENTAL_DAGGER_CACHE_CONFIG: type=gha,mode=max,url=${{ env.ACTIONS_CACHE_URL }},token=${{ env.ACTIONS_RUNTIME_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ui
path: embed
push:
name: Push built UI
# We only push the UI if we are on a push that is not the initial import (count > 0).
if: github.event_name == 'push' && fromJSON(needs.version.outputs.count) > 0
needs:
- build
- version
environment: restricted
runs-on: ubuntu-latest
steps:
- name: Generate an app token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ui
path: embed
- name: Push tag
run: |
version=v${{ needs.version.outputs.version }}
git config user.name "FastTrackML CI"
git config user.email "[email protected]"
git checkout --detach
git rm -r src
git add -f embed
git commit -m "Built UI $version"
git tag -a $version -m "Built UI $version"
git push origin $version