Skip to content

Commit

Permalink
workflow: modified workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
forkimenjeckayang committed Jun 12, 2024
1 parent ad16d89 commit 9220ace
Showing 1 changed file with 8 additions and 46 deletions.
54 changes: 8 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,23 @@ on:
branches:
- main # Trigger on push to the main branch

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2 # Checkout the repository

- name: Set up Git
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
- name: Create Tag
id: create_tag
run: |
TAG="v$(date +'%Y.%m.%d-%H.%M.%S')"
git tag $TAG
git push origin $TAG
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

- name: Generate Release Notes
id: generate_notes
uses: actions/github-script@v6
with:
script: |
const { context, github } = require('@actions/github');
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag = context.ref.replace('refs/tags/', '');
const { data: commits } = await github.repos.listCommits({
owner,
repo,
sha: tag,
per_page: 100
});
let body = 'Changes in this Release\n';
for (const commit of commits) {
body += `- ${commit.commit.message}\n`;
}
return body;
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN}} # GitHub token provided by Actions
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.create_tag.outputs.TAG }} # Use the created tag name
release_name: Release ${{ steps.create_tag.outputs.TAG }} # Name the release
body: ${{ steps.generate_notes.outputs.result }} # Use generated release notes
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}

draft: false
prerelease: false
prerelease: false

0 comments on commit 9220ace

Please sign in to comment.