outline - added role feature to use file_storage local #22
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: Adding a new version, tag & release | |
on: | |
push: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
version_tag_and_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cloning the repository... | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configuring collection & tag versions... | |
run: | | |
# Setting version file | |
version_file="${{ vars.PROJECT_VERSION_FILE }}" | |
# Configuring git | |
git config --global user.name "${{ vars.PROJECT_CI_USERNAME }}" | |
git config --global user.email "${{ vars.PROJECT_CI_EMAIL }}" | |
# Updating the version if PROJECT_UPDATE_VERSION is defined | |
# This allows forked repos to not update the version | |
if [ ! -z ${{ vars.PROJECT_UPDATE_VERSION }} ]; then | |
# Updating the version | |
version_row_old=$(grep "version: " $version_file) | |
version=$(echo $version_row_old | cut -d: -f2) | |
major=$(echo $version | cut -d. -f1) | |
minor=$(echo $version | cut -d. -f2) | |
patch=$(echo $version | cut -d. -f3) | |
patch_new=$(( $patch+1 )) | |
version_row_new="version: $major.$minor.$patch_new" | |
sed -i "s/$version_row_old/$version_row_new/" $version_file | |
# Adding the changed file to git | |
git add $version_file | |
# Committing the change | |
git commit -m "Set ${{ vars.PROJECT_NAME }} version to $major.$minor.$patch_new" | |
git push | |
fi | |
TAG_NAME="v$(grep "version: " $version_file | cut -d ' ' -f 2)" | |
echo "LATEST_TAG=$TAG_NAME" >> $GITHUB_ENV | |
# Tagging and pushing the change | |
git tag $TAG_NAME | |
git push origin $TAG_NAME | |
# Creating temp changelog file | |
git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^^)..HEAD > CHANGELOG.md | |
- name: Releasing a new version... | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.LATEST_TAG }} | |
bodyFile: CHANGELOG.md |