feat: prevent same choice and duplicated keys (#152) #47
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
# Automate releases of new app versions | |
name: Release new app version | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
# TODO: replace this with your app name | |
package-name: graasp-app-quiz | |
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"docs","section":"Documentation","hidden":false},{"type":"test","section":"Tests","hidden":false}]' | |
- uses: actions/checkout@v3 | |
# creates minor and major tags that follow the latest release | |
- name: Tag major and minor versions | |
uses: jacobsvante/[email protected] | |
if: ${{ steps.release.outputs.release_created }} | |
with: | |
major: ${{ steps.release.outputs.major }} | |
minor: ${{ steps.release.outputs.minor }} | |
# put created tag in an env variable to be sent to the dispatch | |
- name: Set tag | |
if: ${{ steps.release.outputs.release_created }} | |
id: set-tag | |
run: | | |
REPOSITORY=$(echo '${{ github.repository }}') | |
TAG=$(echo '${{ steps.release.outputs.tag_name }}') | |
JSON=$(jq -c --null-input --arg repository "$REPOSITORY" --arg tag "$TAG" '{"repository": $repository, "tag": $tag}') | |
echo "json=$JSON" >> $GITHUB_OUTPUT | |
# Trigger an 'on: repository_dispatch' workflow to run in graasp-deploy repository | |
- name: Push tag to Graasp Deploy (Staging) | |
if: ${{ steps.release.outputs.release_created }} | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
repository: graasp/graasp-deploy | |
event-type: update-staging-version | |
client-payload: ${{ steps.set-tag.outputs.json }} | |
- name: Auto Tag | |
id: auto-tag | |
if: ${{ steps.release.outputs.releases_created }} | |
run: | | |
gh label create ${{ env.TAG_NAME }} -f --color 0E8A16 --repo ${{ env.REPO }}; | |
echo '### `${{ env.TAG_NAME }}` :rocket:' >> $GITHUB_STEP_SUMMARY; | |
echo 'Tag all ${{ env.PRE_LABEL_NAME }} issues and prs as ${{ env.TAG_NAME }}'; | |
for cmd in issue pr; | |
do | |
for nbr in $(gh $cmd list -l ${{ env.PRE_LABEL_NAME }} -s all --json number --jq '.[].number' --repo ${{ env.REPO }} ); | |
do | |
URL=$(gh $cmd edit $nbr --add-label ${{ env.TAG_NAME }} --remove-label ${{ env.PRE_LABEL_NAME }} --repo ${{ env.REPO }} ); | |
echo "- $cmd #$nbr $URL" >> $GITHUB_STEP_SUMMARY; | |
done | |
done | |
echo '' >> $GITHUB_STEP_SUMMARY; | |
echo ':rocket: All related issues and prs tagged !' >> $GITHUB_STEP_SUMMARY; | |
echo ':scroll: Check out [the created release](${{ env.RELEASE_URL }}) !' >> $GITHUB_STEP_SUMMARY; | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
TAG_NAME: ${{ steps.release.outputs.tag_name }} | |
PRE_LABEL_NAME: un-released | |
REPO: ${{ github.event.repository.full_name }} | |
RELEASE_URL: ${{ github.event.repository.html_url }}/releases/tag/${{ steps.release.outputs.tag_name }} |