-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(frontend): fix release workflow (#87)
* chore(frontend): fix git commit command * chore(frontend): temporary fix to check if it works * chore(frontend): add logging for bump script * chore(frontend): fix git push command * chore(frontend): force git push * chore(frontend): give up on pushing to a protected branch * chore(frontend): try an API request to override branch protection * chore(frontend): use another approach for branch protection disabling * chore(frontend): update git push script * chore(frontend): stop using BRANCH env variable to avoid injection vulnerability * chore(frontend): move bumping to a bash script * chore(frontend): fix sed call * chore(frontend): remove unnecessary package
- Loading branch information
Showing
6 changed files
with
231 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,14 +34,11 @@ jobs: | |
env: | ||
CI: true | ||
- name: Bump New Version | ||
run: | | ||
npm run bump -- -v ${{ github.event.release.tag_name }} | ||
git commit -m "chore(release): ${{ github.event.release.tag_name }}" | ||
git push | ||
run: sh scripts/bump.sh | ||
env: | ||
GIT_AUTHOR_NAME: Vaadin Bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
REPO: ${{ github.repository }} | ||
VERSION_TAG: ${{ github.event.release.tag_name }} | ||
- name: Publish | ||
run: npm run publish | ||
env: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
|
||
alias ghr="curl https://api.github.com/repos/$REPO/branches/main/protection \ | ||
-H 'Accept: application/vnd.github.v3+json' \ | ||
-H 'Authorization: token $GITHUB_TOKEN'" | ||
|
||
node scripts/update-package-versions.js "$VERSION_TAG" | ||
|
||
git add --all | ||
|
||
git \ | ||
-c user.name='Vaadin Bot' \ | ||
-c user.email='[email protected]' \ | ||
commit -m "chore(release): $VERSION_TAG" | ||
|
||
protection_config=$(ghr -X GET) | ||
|
||
remapped=$(node scripts/protection-remap.js "$protection_config") | ||
|
||
ghr -X PUT -d "$(echo "$remapped" | sed '$s/"enforce_admins":true/"enforce_admins":false/')" | ||
|
||
git push origin HEAD:main | ||
|
||
ghr -X PUT -d "$remapped" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable import/no-extraneous-dependencies,camelcase */ | ||
import meow from 'meow'; | ||
|
||
const { | ||
input: [response], | ||
} = meow({ importMeta: import.meta }); | ||
|
||
const { | ||
required_status_checks, | ||
enforce_admins, | ||
required_pull_request_reviews, | ||
restrictions, | ||
required_linear_history, | ||
allow_force_pushes, | ||
allow_deletions, | ||
required_conversation_resolution, | ||
} = JSON.parse(response); | ||
|
||
const remapped = { | ||
required_status_checks: required_status_checks | ||
? { | ||
strict: required_status_checks.strict, | ||
contexts: required_status_checks.contexts, | ||
} | ||
: null, | ||
enforce_admins: enforce_admins?.enabled ?? null, | ||
required_pull_request_reviews: required_pull_request_reviews | ||
? { | ||
dismissal_restrictions: required_pull_request_reviews.dismissal_restrictions | ||
? { | ||
users: required_pull_request_reviews.dismissal_restrictions.users.map(({ login }) => login), | ||
teams: required_pull_request_reviews.dismissal_restrictions.teams.map(({ slug }) => slug), | ||
} | ||
: {}, | ||
dismiss_stale_reviews: required_pull_request_reviews.dismiss_stale_reviews, | ||
require_code_owner_reviews: required_pull_request_reviews.require_code_owner_reviews, | ||
required_approving_review_count: required_pull_request_reviews.required_approving_review_count, | ||
} | ||
: null, | ||
restrictions: restrictions?.enabled ?? null, | ||
required_linear_history: required_linear_history?.enabled ?? false, | ||
allow_force_pushes: allow_force_pushes?.enabled ?? null, | ||
allow_deletions: allow_deletions?.enabled ?? false, | ||
required_conversation_resolution: required_conversation_resolution?.enabled ?? false, | ||
}; | ||
|
||
process.stdout.write(JSON.stringify(remapped)); |
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