Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Deprecate the library #60

Deprecate the library

Deprecate the library #60

Workflow file for this run

name: Release automatically
on:
pull_request:
branches:
- main
types:
- closed
jobs:
release-from-pr:
name: Release from a PR that is marked with [new release]
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'new release')
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Fetch the version number 📝
id: fetch-version
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const package = require(`${process.env.GITHUB_WORKSPACE}/attractions/package.json`);
return `v${package.version}`;
- name: Fetch the changelog 📝
id: fetch-changelog
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const changelog = require('fs').readFileSync('CHANGELOG.md', { encoding: 'utf-8' }).split('\n');
const start = changelog.findIndex(line => line.startsWith('## '));
const end = changelog.findIndex((line, index) => line.startsWith('## ') && index > start);
return changelog.slice(start + 1, end).join('\n').trim();
- name: Create a release 🔖
uses: actions/github-script@v7
env:
CHANGELOG: ${{ steps.fetch-changelog.outputs.result }}
with:
script: |
await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: "${{ steps.fetch-version.outputs.result }}",
name: "${{ steps.fetch-version.outputs.result }}",
body: process.env.CHANGELOG,
});