Skip to content

Merge pull request #53 from CityOfDetroit/detroitmi.build #5

Merge pull request #53 from CityOfDetroit/detroitmi.build

Merge pull request #53 from CityOfDetroit/detroitmi.build #5

Workflow file for this run

name: Auto Release
on:
push:
branches:
- main # Only run on the main branch
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Get current version from package.json
id: current_version
run: |
CURRENT_VERSION=$(jq -r '.version' package.json)
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Get previous version from Git
id: previous_version
run: |
PREV_VERSION=$(git show HEAD~1:package.json | jq -r '.version')
echo "PREV_VERSION=$PREV_VERSION" >> $GITHUB_ENV
- name: Check if version has changed
if: ${{ env.CURRENT_VERSION == env.PREV_VERSION }}
run: |
echo "Version has not changed. Exiting."
exit 0
- name: Create Tag
if: ${{ env.CURRENT_VERSION != env.PREV_VERSION }}
run: |
git tag -a "v${{ env.CURRENT_VERSION }}" -m "Release version ${{ env.CURRENT_VERSION }}"
git push origin "v${{ env.CURRENT_VERSION }}"
- name: Create GitHub Release
if: ${{ env.CURRENT_VERSION != env.PREV_VERSION }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ env.CURRENT_VERSION }}"
release_name: "Release v${{ env.CURRENT_VERSION }}"
body: "Automated release for version ${{ env.CURRENT_VERSION }}"
draft: false
prerelease: false