Skip to content

Create new version #838

Create new version

Create new version #838

name: Create new version
on:
workflow_dispatch:
inputs:
SEMVER_LEVEL:
description: One of {BUILD, PATCH, MINOR, MAJOR}
required: true
default: BUILD
type: string
workflow_call:
inputs:
SEMVER_LEVEL:
description: One of {BUILD, PATCH, MINOR, MAJOR}
required: false
default: BUILD
type: string
outputs:
NEW_VERSION:
description: The new version string
value: ${{ jobs.createNewVersion.outputs.NEW_VERSION }}
secrets:
LARGE_SECRET_PASSPHRASE:
description: Passphrase used to decrypt GPG key
required: true
SLACK_WEBHOOK:
description: Webhook used to comment in slack
required: true
jobs:
validateActor:
runs-on: ubuntu-latest
outputs:
# TODO: fix this so we check if admin is true, as well as push
# https://docs.github.com/en/rest/apps/installations?apiVersion=2022-11-28#list-repositories-accessible-to-the-user-access-token
HAS_WRITE_ACCESS: ${{ contains(fromJSON('["write", "admin"]'), steps.getUserPermissions.outputs.PERMISSION) }}
steps:
- name: Get user permissions
id: getUserPermissions
run: echo "PERMISSION=$(gh api /users/installations/${{ secrets.OS_BOTIFY_INSTALLATION_ID }}/repositories | jq -r '.repositories[].permissions')" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: fixme
createNewVersion:
runs-on: macos-latest
needs: validateActor
# if: ${{ fromJSON(needs.validateActor.outputs.HAS_WRITE_ACCESS) }}
outputs:
NEW_VERSION: ${{ steps.bumpVersion.outputs.NEW_VERSION }}
steps:
- uses: softprops/turnstyle@ca99add00ff0c9cbc697d22631d2992f377e5bd5
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.token }}
- uses: actions/checkout@v3
with:
ref: main
token: ${{ steps.setupGitForOSBotify.outputs.token }}
- uses: Expensify/App/.github/actions/composite/setupGitForOSBotify@main
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
- name: Generate version
id: bumpVersion
uses: Expensify/App/.github/actions/javascript/bumpVersion@main
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.token }}
SEMVER_LEVEL: ${{ inputs.SEMVER_LEVEL }}
- name: Commit new version
run: |
git add \
./package.json \
./package-lock.json \
./android/app/build.gradle \
./ios/NewExpensify/Info.plist \
./ios/NewExpensifyTests/Info.plist
git commit -m "Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}"
- name: Update main branch
run: git push origin main
# - if: ${{ failure() }}
# uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
# with:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}