Skip to content

Add auth step to all other impacted workflows #820

Add auth step to all other impacted workflows

Add auth step to all other impacted workflows #820

name: Build release candidate
on:
push:
branches:
- '*'
paths:
- '.holo/config.toml'
- '.holo/sources/jarvus-cluster-template.toml'
- '.holo/branches/releases/**'
- '.github/workflows/service-*'
- 'ci/**'
- 'kubernetes/apps/**'
- 'kubernetes/system/**'
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_TOKEN }}
BIO_RELEASE: 1.6.372
jobs:
build-release-candidate:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_ACTIONS_TOKEN }}
- name: 'Build release candidate branch'
run: |
# dependency setup
curl -LO "https://github.com/biome-sh/biome/releases/download/v1.6.372/bio-$BIO_RELEASE-x86_64-linux.tar.gz"
tar xzvf "bio-$BIO_RELEASE-x86_64-linux.tar.gz"
sudo mv bio /usr/local/bin/bio
sudo bio pkg install --binlink jarvus/hologit
# environment setup
[[ ! $(git status --porcelain=v1) ]] || git stash -u
git config user.name "Github Action $GITHUB_JOB"
git config user.email "$(whoami)@$(uname -n)"
remote_name=origin
source_branch=${GITHUB_REF#refs/heads/}
candidate_ref=refs/heads/candidates/$source_branch
prod_ref=refs/heads/releases/prod
prod_remote_ref=refs/remotes/$remote_name/${prod_ref#refs/heads/}
# branch setup
git update-ref -d "$prod_remote_ref"
git update-ref -d "$candidate_ref"
if [[ $(git ls-remote "$remote_name" "$prod_ref") ]]; then
git fetch "$remote_name" "$prod_ref"
fi
# build & push
commit_msg="Release candidate: $source_branch
Source-holobranch: release-candidate
Source-commit: $(git rev-list HEAD -1)"
git holo project release-candidate --commit-to "$prod_remote_ref" --commit-message "$commit_msg"
git update-ref "$candidate_ref" "$prod_remote_ref"
git push -f "$remote_name" "$candidate_ref"