Skip to content

Update from release branches #2693

Update from release branches

Update from release branches #2693

name: Update from release branches
on:
workflow_dispatch:
inputs:
force_release:
description: 'Force creating the release branch'
required: false
type: boolean
default: false
workflow_run:
workflows: [Update from upstream]
types: [completed]
jobs:
update-upstream-v3:
runs-on: ubuntu-latest
container: golang:latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@master
- name: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPSTREAM: https://github.com/sylabs/singularity
run: |
USER_INPUT=${{ inputs.force_release }}
FORCE_RELEASE=${USER_INPUT:-false}
echo "MIRRORSITE=http://archive.ubuntu.com/ubuntu/" > /etc/pbuilderrc
apt-get -qq -y update
apt-get -qq -y install bash git python3 devscripts git-buildpackage
rm -rf singularity
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/ctu-vras/singularity.git
cd singularity
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git config --global rerere.enabled true
git remote add upstream "${UPSTREAM}"
git fetch upstream
git fetch origin
cp -r .github/workflows/rr-cache .git/
git checkout cras-v3 || git checkout -b cras-v3
branch="$(git ls-remote --heads -q upstream | cut -d' ' -f2 | sed 's#refs/heads/##' | grep 'release-3' | sort -n -k2 -t. -r | head -n1)"
echo "Rebasing onto branch $branch"
git reset --hard origin/cras
git rebase --onto=upstream/${branch} --rerere-autoupdate upstream/main cras-v3 || GIT_EDITOR=true git rebase --continue
echo "FORCE_RELEASE=${FORCE_RELEASE}"
[ "${FORCE_RELEASE}" != "true" ] && [ "$(git rev-parse cras-v3)" = "$(git rev-parse origin/cras-v3)" ] && exit 0
git push --force origin cras-v3
git checkout debian-release-v3 || git checkout -b debian-release-v3
git reset --hard cras-v3
git submodule update --init
PATH=/usr/local/go/bin:$PATH debian/prepare.sh
git commit -m "Upstream release $(cat VERSION)"
git push --force origin debian-release-v3
update-upstream-v4:
runs-on: ubuntu-latest
container: golang:latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@master
- name: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
UPSTREAM: https://github.com/sylabs/singularity
run: |
USER_INPUT=${{ inputs.force_release }}
FORCE_RELEASE=${USER_INPUT:-false}
echo "MIRRORSITE=http://archive.ubuntu.com/ubuntu/" > /etc/pbuilderrc
apt-get -qq -y update
apt-get -qq -y install bash git python3 devscripts git-buildpackage
rm -rf singularity
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/ctu-vras/singularity.git
cd singularity
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git config --global rerere.enabled true
git remote add upstream "${UPSTREAM}"
git fetch upstream
git fetch origin
cp -r .github/workflows/rr-cache .git/
git checkout cras-v4 || git checkout -b cras-v4
branch="$(git ls-remote --heads -q upstream | cut -d' ' -f2 | sed 's#refs/heads/##' | grep 'release-4' | sort -n -k2 -t. -r | head -n1)"
echo "Rebasing onto branch $branch"
git reset --hard origin/cras
git rebase --onto=upstream/${branch} --rerere-autoupdate upstream/main cras-v4 || GIT_EDITOR=true git rebase --continue
echo "FORCE_RELEASE=${FORCE_RELEASE}"
[ "${FORCE_RELEASE}" != "true" ] && [ "$(git rev-parse cras-v4)" = "$(git rev-parse origin/cras-v4)" ] && exit 0
git push --force origin cras-v4
git checkout debian-release-v4 || git checkout -b debian-release-v4
git reset --hard cras-v4
git submodule update --init
PATH=/usr/local/go/bin:$PATH debian/prepare.sh
git commit -m "Upstream release $(cat VERSION)"
git push --force origin debian-release-v4