Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: force release for automated libsbp releases #1365

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/force-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Force release libsbp
on:
workflow_dispatch:
inputs:
major:
description: 'Semver major label'
type: number
required: true
minor:
description: 'Semver minor label'
type: number
required: true
patch:
description: 'Semver patch label'
type: number
required: true
prep-next-release:
description: 'Prep next release, this should only be triggered after a release has been made'
type: boolean
required: false
default: false
env:
MAJOR: ${{ github.event.inputs.major }}
MINOR: ${{ github.event.inputs.minor }}
PATCH: ${{ github.event.inputs.patch }}
PREP_NEXT: ${{ github.event.inputs.prep-next-release }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Echo inputs
run: |
echo "major: ${{ github.event.inputs.major }}"
echo "minor: ${{ github.event.inputs.minor }}"
echo "patch: ${{ github.event.inputs.patch }}"
echo "v$MAJOR.$MINOR.$PATCH"
- uses: actions/checkout@v2
- name: Update C version
run: |
sed -i "s/define SBP_MAJOR_VERSION .*/define SBP_MAJOR_VERSION $MAJOR/" c/include/libsbp/version.h
sed -i "s/define SBP_MINOR_VERSION .*/define SBP_MINOR_VERSION $MINOR/" c/include/libsbp/version.h
sed -i "s/define SBP_PATCH_VERSION .*/define SBP_PATCH_VERSION $PATCH/" c/include/libsbp/version.h
if [ $PREP_NEXT ]; then
sed -i "s/define SBP_VERSION \".*\"/define SBP_VERSION \"$MAJOR.$MINOR.$PATCH-alpha\"/" c/include/libsbp/version.h
else
sed -i "s/define SBP_VERSION \".*\"/define SBP_VERSION \"$MAJOR.$MINOR.$PATCH\"/" c/include/libsbp/version.h
fi
- name: Update Haskell version
run: |
if [ $PREP_NEXT ]; then
sed -i "0,/^version: .*/s//version: $MAJOR.$MINOR.$PATCH-alpha/" haskell/sbp.cabal
else
sed -i "0,/^version: .*/s//version: $MAJOR.$MINOR.$PATCH/" haskell/sbp.cabal
fi
- name: Update Javascript version
run: |
if [ $PREP_NEXT ]; then
echo -n "$MAJOR.$MINOR.$PATCH-alpha" > javascript/sbp/RELEASE-VERSION
jq --arg v "$MAJOR.$MINOR.$PATCH-alpha" '.version = $v' package.json > tmp1.$$.json && mv tmp1.$$.json package.json
jq --arg v "$MAJOR.$MINOR.$PATCH-alpha" '.version = $v | .packages[""].version = $v' package-lock.json > tmp2.$$.json && mv tmp2.$$.json package-lock.json
else
echo -n "$MAJOR.$MINOR.$PATCH" > javascript/sbp/RELEASE-VERSION
jq --arg v "$MAJOR.$MINOR.$PATCH" '.version = $v' package.json > tmp1.$$.json && mv tmp1.$$.json package.json
jq --arg v "$MAJOR.$MINOR.$PATCH" '.version = $v | .packages[""].version = $v' package-lock.json > tmp2.$$.json && mv tmp2.$$.json package-lock.json
fi
- name: Update Python version
run: |
echo -n "$MAJOR.$MINOR.$PATCH" > python/sbp/RELEASE-VERSION
- name: Update Rust version
run: |
if [ $PREP_NEXT ]; then
sed -i "0,/version = \".*\"/s//version = \"$MAJOR.$MINOR.$PATCH\"/" rust/sbp/Cargo.toml
sed -i "0,/version = \".*\"/s//version = \"$MAJOR.$MINOR.$PATCH-unreleased\"/" rust/sbp2json/Cargo.toml
else
sed -i "0,/version = \".*\"/s//version = \"$MAJOR.$MINOR.$PATCH-alpha\"/" rust/sbp/Cargo.toml
sed -i "0,/version = \".*\"/s//version = \"$MAJOR.$MINOR.$PATCH-alpha\"/" rust/sbp2json/Cargo.toml
fi
- name: Update CHANGELOG
if: ${{ github.event.inputs.prep-next-release }}
run: echo "test123"
# - name: Update PDF
# run: echo "TODO"
# - name: Commit changes
# run: |
# git checkout -b "force-release-v$MAJOR.$MINOR.$PATCH"
# git add .
# git status
# git commit -m "force release v$MAJOR.$MINOR.$PATCH"
# git push --set-upstream origin "force-release-v$MAJOR.$MINOR.$PATCH"
- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GH_TOKEN }}
commit-message: "chore: force release v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}"
title: "chore: force release v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}"
body: "automated release of v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}"
branch: "force-release-v${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}"
base: "master"
author: "swiftnav-travis <[email protected]>"
delete-branch: true
add-paths: |
*
Loading