Skip to content

Commit

Permalink
refactor: migrated another script
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed Jan 3, 2025
1 parent 83298f5 commit a95e172
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
22 changes: 22 additions & 0 deletions .github/scripts/get-release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import process from 'process';

const GITHUB_REF = process.env.GITHUB_REF;
const GITHUB_ACTOR = process.env.GITHUB_ACTOR;
const GITHUB_COMMITISH = process.env.GITHUB_COMMITISH;
const GITHUB_PRE_RELEASE = process.env.GITHUB_PRE_RELEASE === 'true';

if (GITHUB_REF && GITHUB_REF.startsWith('refs/tags/v')) {
if (GITHUB_ACTOR !== 'dependabot[bot]') {
if (GITHUB_COMMITISH === 'main' && !GITHUB_PRE_RELEASE) {
console.log('RELEASE');
} else {
console.log('PRE_RELEASE');
}
} else {
console.error('Dependabot has no permission to publish!');
process.exit(1);
}
} else {
console.error("Your tag has to start with 'v'");
process.exit(1);
}
17 changes: 0 additions & 17 deletions .github/scripts/get-release.sh

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/01-get-publish-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ jobs:
uses: ./.github/actions/npm-cache

- name: 💃🕺 Check if release or prerelease
uses: actions/github-script@v7
id: releaseCheck
with:
script: |
const { default: getRelease } = await import('${{ github.workspace }}/.github/scripts/get-release.js');
return await getRelease();
run: |
chmod +rx ./.github/scripts/get-release.sh
chmod +rx ./.github/scripts/
OUTPUT=$(./.github/scripts/get-release.sh)
if [[ $OUTPUT == "RELEASE" ]];
then
Expand Down

0 comments on commit a95e172

Please sign in to comment.