Skip to content

Commit

Permalink
fix: upgrade workflow versions (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaenleh authored Jan 9, 2025
1 parent b8ee7d8 commit 63933bb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 54 deletions.
25 changes: 8 additions & 17 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ name: cypress tests
on:
push:
branches-ignore:
- 'release-please-**'
- "release-please-**"

jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: set up node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: "20"

- name: Yarn Install and Cache
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
with:
cypress: true

- name: cypress run
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
env:
REACT_APP_API_HOST: http://localhost:3636
REACT_APP_GRAASP_DOMAIN: localhost
Expand All @@ -35,35 +35,26 @@ jobs:
build: yarn build
config: baseUrl=http://localhost:3000
start: yarn start:ci
wait-on: 'http://localhost:3000'
wait-on: "http://localhost:3000"
wait-on-timeout: 180
browser: chrome
quiet: true
# point to new cypress@10 config file
config-file: cypress.config.ts

# component tests are not running ok in the CI
# - name: Run Component tests 🧪
# uses: cypress-io/github-action@v4
# with:
# # we have already installed everything
# install: false
# # to run component tests we need to use "component: true"
# component: true

# after the test run completes
# store videos and any screenshots
# NOTE: screenshots will be generated only if E2E test failed
# thus we store screenshots only on failures
# Alternative: create and commit an empty cypress/screenshots folder
# to always have something to upload
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
environment: development
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Yarn install and Cache dependencies
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.tag }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.tag }}

Expand Down
46 changes: 12 additions & 34 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,30 @@ name: Release new app version
on:
push:
branches:
- 'main'
- "main"

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@v4
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
- uses: actions/checkout@v4

# 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 }}
if: ${{ steps.release.outputs.releases_created == 'true' }}
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 }}
if: ${{ steps.release.outputs.releases_created == 'true' }}
id: set-tag
run: |
REPOSITORY=$(echo '${{ github.repository }}')
Expand All @@ -40,35 +37,16 @@ jobs:
# 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
if: ${{ steps.release.outputs.releases_created == 'true' }}
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: graasp/graasp-deploy
event-type: update-staging-version
client-payload: ${{ steps.set-tag.outputs.json }}
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 }}
uses: graasp/graasp-deploy/.github/actions/auto-tag-after-release@v1
with:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs.tag_name }}

0 comments on commit 63933bb

Please sign in to comment.