update yarn #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Release and Build' | |
on: | |
workflow_dispatch: | |
inputs: | |
prerelease: | |
description: "Prerelease" | |
required: true | |
default: false | |
type: boolean | |
draft: | |
description: "Draft" | |
required: true | |
default: false | |
type: boolean | |
version-increment-type: | |
description: 'Which part of the version to increment:' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
default: 'patch' | |
push: | |
branches: | |
- '*' | |
permissions: | |
contents: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Setup Yarn | |
run: | | |
corepack enable | |
corepack prepare [email protected] --activate | |
- name: Install dependencies | |
shell: bash | |
run: yarn install | |
- name: Build project | |
shell: bash | |
run: yarn build | |
- name: Prepare Release | |
id: prepare_release | |
uses: DevCycleHQ/release-action/[email protected] | |
with: | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
version-increment-type: ${{ github.event.inputs.version-increment-type || 'patch' }} | |
prerelease: ${{ github.event.inputs.prerelease }} | |
draft: ${{ github.event.inputs.draft }} | |
- name: Update README.md | |
run: | | |
sed -i -E 's/(DevCycleHQ\/feature-flag-code-usage-action@)(main|v[0-9]+\.[0-9]+\.[0-9]+)/\1${{steps.prepare_release.outputs.next-release-tag}}/g' README.md | |
if: github.event.inputs.draft != true | |
- name: Commit version change and README update | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "DevCycle Automation" | |
git add . | |
git commit -m "Release ${{steps.prepare_release.outputs.next-release-tag}} and update README" | |
if: github.event.inputs.draft != true | |
- name: Push version change | |
run: | | |
git push origin HEAD:release-workflow # Change this to your test branch name | |
if: github.event.inputs.draft != true | |
- name: Create Release | |
id: create_release | |
uses: DevCycleHQ/release-action/[email protected] | |
with: | |
tag: ${{ steps.prepare_release.outputs.next-release-tag }} | |
target: ${{ github.sha }} | |
changelog: ${{ steps.prepare_release.outputs.changelog }} | |
github-token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
prerelease: ${{ github.event.inputs.draft }} | |
draft: ${{ github.event.inputs.draft }} |