deprecate getBedsByRoom (#853) #143
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
name: Publish Bufs | |
on: | |
push: | |
branches: [ 'main' ] | |
paths: | |
- proto/**/*.proto | |
- gen/**/* | |
env: | |
# renovate: datasource=github-releases depName=bufbuild/buf | |
BUF_CLI_VERSION: '1.37.0' | |
NODE_VERSION: '18.x' | |
# renovate: datasource=dart-version depName=dart | |
DART_VERSION: '3.5.1' | |
jobs: | |
check-preconditions: | |
runs-on: ubuntu-22.04 | |
outputs: | |
bump: ${{ steps.bump.outputs.bump }} | |
commit: ${{ steps.commit.outputs.sha }} | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- uses: bufbuild/buf-setup-action@v1.40.1 | |
with: | |
version: ${{ env.BUF_CLI_VERSION }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: bufbuild/buf-lint-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# TODO (arm-versioning): Arm versioning by remove the comment of ONLY the next line | |
# - name: Check for illegal breakage | |
# Only deletions are allowed. Breaking updates must happen in a new version of the package(s) in question. | |
# This is just a sanity check! | |
# For example it allows you to delete files from the latest version of a package (depending on context that might even be ok). | |
# TODO (arm-versioning): Arm versioning by remove the comment of the next line | |
# run: buf breaking --against '.git#ref=HEAD^' --error-format json | jq .type | if grep -v -q \"FILE_NO_DELETE\"; then exit 1; fi | |
- name: Has breakage? | |
id: breaking | |
# We previously checked if any illegal breakage occurred, now check if we have breakage _at all_ | |
# If so, we publish this as a _major_ release | |
run: buf breaking --against '.git#ref=HEAD^' && echo "breaking=false" >> $GITHUB_OUTPUT || echo "breaking=true" >> $GITHUB_OUTPUT | |
- name: Has new package? | |
id: new-package | |
run: | | |
last_tree=$(git ls-tree -d -r --name-only HEAD^ proto | sort) # directory tree of proto in old commit | |
current_tree=$(find proto -type d | sort) # directory tree of proto right now | |
new_dirs=$(comm -13 <(echo "$last_tree") <(echo "$current_tree")) # filter out lines, which are "-3": common (i.e. unchanged) or "-1": only in the last tree (i.e. removed) | |
echo $new_dirs | |
if [ -z "$new_dirs" ]; then | |
echo "new-package=false" >> $GITHUB_OUTPUT | |
else | |
echo "new-package=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Get SHA | |
id: commit | |
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Get Bump | |
id: bump | |
run: | | |
BUMP="patch" | |
if [ "$BREAKING" = "true" ]; then | |
# TODO (arm-versioning): Arm versioning by replacing the following "minor" with "major" | |
BUMP="minor" | |
elif [ "$NEW_PKG" = "true" ]; then | |
BUMP="minor" | |
else | |
BUMP="patch" | |
fi | |
echo "bump=$BUMP" >> $GITHUB_OUTPUT | |
env: | |
BREAKING: ${{ steps.breaking.outputs.breaking }} | |
NEW_PKG: ${{ steps.new-package.outputs.new-package }} | |
ts: | |
needs: check-preconditions | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Fetch latest version from registry | |
working-directory: gen/ts | |
run: npm version $(npm view . version) | |
- name: Bump version | |
working-directory: gen/ts | |
run: npm version pre$BUMP --preid $SHA | |
env: | |
BUMP: ${{ needs.check-preconditions.outputs.bump }} | |
SHA: ${{ needs.check-preconditions.outputs.commit }} | |
- run: npm publish --access public | |
working-directory: gen/ts | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
dart: | |
needs: | |
- check-preconditions | |
- ts | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Clone Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Install tools | |
run: | | |
wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver | |
chmod +x /usr/local/bin/semver | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: ${{ env.DART_VERSION }} | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
with: | |
version: '>= 363.0.0' | |
- name: Auth Service Account | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.PUB_DEV_KEY }} | |
- name: Set pub.dev token | |
run: | | |
gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev | |
- name: Bump version | |
working-directory: gen/dart | |
env: | |
BUMP: ${{ needs.check-preconditions.outputs.bump }} | |
SHA: ${{ needs.check-preconditions.outputs.commit }} | |
run: | | |
VERSION=$(curl https://pub.dev/api/packages/helpwave_proto_dart -H "Accept: application/vnd.pub.v2+json" | jq ".latest.version" -r) | |
NEW_VERSION=$(semver bump $BUMP $VERSION) | |
NEW_VERSION=$(semver bump prerel $SHA $NEW_VERSION) | |
sed "s/version:.*/version: $NEW_VERSION/" pubspec.yaml -i | |
- name: Publish to pub.dev | |
working-directory: gen/dart | |
run: dart pub publish -f |