geoff-maddock / events-tracker

CRM and calendar to track events, weekly and monthly series, promoters, artists, producers, djs, venues and other entities.
https://arcane.city
MIT License
16 stars 6 forks source link

Automatic release tagging? #1158

Closed geoff-maddock closed 8 months ago

geoff-maddock commented 9 months ago

Could look into adding a github workflow to do this, see the tag.yml in expedient/is-codegen:

name: Tag

on: 
  push:
    branches:
      - main
    paths-ignore:
      - 'version.go'
      - '.github/*'
      - '.vscode/*'
      - 'README.md'
      - '.gitignore'

jobs:
  release-on-push:
    permissions:
      contents: write
    runs-on: ubuntu-20.04
    env:
      GITHUB_TOKEN: ${{ secrets.IS_CICD_GITHUB_ACTION_TOKEN }}
    steps:
      - id: get-new-version
        uses: rymndhng/release-on-push-action@master
        with:
          bump_version_scheme: minor
          tag_prefix: v
          dry_run: true

      - name: Check Out Repo 
        uses: actions/checkout@v3
        with:
          token: ${{ secrets.IS_CICD_GITHUB_ACTION_TOKEN }}

      # commit new version
      - name: Setup git
        run: |
          git config --global user.name "github-action-bot"
          git config --global user.email "information-systems@expedient.com"
          git fetch
          git checkout releases
          git reset --hard main

      - name: update version
        run: |
          cat version.go.tmpl > version.go
          echo "\"${{ steps.get-new-version.outputs.tag_name }}\"" >> version.go

      - name: Git commit the updated version to version.go
        # Only commits if there are changes.
        run: |
          git add .
          git update-index --refresh
          git diff-index --quiet HEAD || git commit -m "Set version to ${{ steps.get-new-version.outputs.tag_name }}"

      - name: tag the commit with the new version and latest
        run: |
          git tag -d latest || true
          git push --delete origin latest || true
          git tag -a latest -m "latest"
          git tag -a ${{ steps.get-new-version.outputs.tag_name }} -m "Release ${{ steps.get-new-version.outputs.tag_name }}"

      - name: Git push changes
        run: |
          git status
          git push --force origin releases --follow-tags

      - name: Create Release
        uses: ncipollo/release-action@v1
        with:
          name: ${{ steps.get-new-version.outputs.tag_name }}
          tag: ${{ steps.get-new-version.outputs.tag_name }}
geoff-maddock commented 9 months ago

Probably DON'T want to do this since I'd rather have it be a manual release process...but I'm not doing great with packaging releases.