colin-gourlay / sundown-sessions

🌎 The Sundown Sessions website.
https://sundownsessions.co.uk/
MIT License
0 stars 0 forks source link

Continuous Integration of Releases #131

Open colin-gourlay opened 3 weeks ago

colin-gourlay commented 3 weeks ago

Automagically create tags and releases

SureshPradhana commented 5 days ago

Hello, I made an action for creating tags and releases, but I am not sure about the format for the tags and releases. Here is the output it creates:

v20240623145259

Changes in this Release:

- First Change
- Second Change

Here is the code:

name: Create Tag and Release

on:
  push:
    branches:
      - main

jobs:
  create_tag_and_release:
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Set up Git
      run: |
        git config --global user.name 'github-actions'
        git config --global user.email 'github-actions@github.com'

    - name: Get the current date
      id: date
      run: echo "date=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV

    - name: Create a new tag
      run: |
        git tag v${{ env.date }}
        git push origin v${{ env.date }}

    - name: Create a release
      uses: actions/create-release@v1
      with:
        tag_name: v${{ env.date }}
        release_name: v${{ env.date }}
        body: |
            Changes in this Release:
            - First Change
            - Second Change
        draft: false
        prerelease: false
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}