Skip to content

Publish

Publish #95

Workflow file for this run

name: Publish
on:
pull_request:
workflow_dispatch:
inputs:
vault_version:
description: "Vault version"
required: true
type: string
bump-package:
description: |-
How to bump this package version:
- `none` - do not bump version
- `patch` - bump patch version
- `minor` - bump minor version
- `major` - bump major version
default: patch
type: choice
options:
- none
- patch
- minor
- major
jobs:
update-versions:
name: Bump versions and test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.CICD_RELEASES_PAT }}
- name: Update README and resources to reference Vault version ${{ inputs.vault_version }}
env:
LINE: compatible with Vault version
if: github.event_name == 'workflow_dispatch'
run: |
sed -i -E "s|$LINE [0-9]+\.[0-9]+\.[0-9]+|$LINE ${{ inputs.vault_version }}|g" README.md
sed -i -E "s|pvault-server:[0-9]+\.[0-9]+\.[0-9]+|pvault-server:${{ inputs.vault_version }}|g" .env.example
- name: Update README to reference demo version upgrade ${{ inputs.bump-package }}
env:
LINE: This demo application version is
if: github.event_name == 'workflow_dispatch' && inputs.bump-package != 'none'
run: |
# find current version
CUR_VER=`sed -n "s/$LINE \([^ ]*\).*/\1/p" README.md`
NEXT_VER=`npx --yes semver -i ${{ inputs.bump-package }} ${CUR_VER}`
sed -i -E "s|$LINE [0-9]+\.[0-9]+\.[0-9]+|$LINE $NEXT_VER|g" README.md
- name: basic funcionality test
run: |
# use the default environment before running
cp .env.example .env
# create the directory for the API keys for the test
mkdir keys
# chown -R 1000:1000 keys
bash ./test.sh --minimal
env:
PVAULT_SERVICE_LICENSE: ${{ secrets.PVAULT_SERVICE_LICENSE }}
- name: Commit and push changes
# even though we're checking for workflow_dispatch we still want to be extra safe and
# make sure we don't push changes to workflow that is triggered by push event.
if: github.event_name == 'workflow_dispatch' && github.event_name != 'push'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git_status=$(git status -s)
if [ -n "$git_status" ]; then
echo "There are changes to commit"
git add README.md .env.example
git commit -a -m 'Update README.md and .env.example files to Vault version ${{ inputs.vault_version }}'
git push
else
echo "No changes to commit"
fi