Skip to content

Commit c28ac71

Browse files
authored
chore: update GitHub Actions to use latest versions of actions and Node.js (#1084)
1 parent 3409198 commit c28ac71

File tree

7 files changed

+129
-130
lines changed

7 files changed

+129
-130
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ jobs:
55
build:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v3
9-
- uses: actions/setup-node@v3
8+
- uses: actions/checkout@v4
9+
- uses: actions/setup-node@v4
1010
with:
11-
node-version: 18
11+
node-version: 20
1212
cache: 'npm'
1313
- name: Get Commit Hash and generate Version File
1414
run: echo "${{ github.event.pull_request.head.sha }}" >> public/hash.txt
@@ -25,10 +25,10 @@ jobs:
2525
build-storybook:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v3
29-
- uses: actions/setup-node@v3
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
3030
with:
31-
node-version: 18
31+
node-version: 20
3232
cache: 'npm'
3333
- name: Run install
3434
run: npm ci
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
name: dist-storybook
4141
path: dist/storybook
42-
42+
4343
- name: Save PR number
4444
env:
4545
PR_NUMBER: ${{ github.event.number }}

.github/workflows/cd.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ on:
66
jobs:
77
cd:
88
environment: production
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Get Commit Hash and generate Version File
13-
run: echo "$(git rev-parse --short HEAD)" >> public/hash.txt
14-
- env:
15-
DOCKER_APP_IMAGE_NAME: "ghcr.io/hasadna/open-bus-map-search/open-bus-map-search"
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17-
HASADNA_K8S_DEPLOY_KEY: ${{ secrets.HASADNA_K8S_DEPLOY_KEY }}
18-
run: |
19-
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u hasadna --password-stdin &&\
20-
if docker pull "${DOCKER_APP_IMAGE_NAME}:latest"; then
21-
CACHE_FROM_ARG="--cache-from ${DOCKER_APP_IMAGE_NAME}:latest"
22-
else
23-
CACHE_FROM_ARG=""
24-
fi &&\
25-
docker build $CACHE_FROM_ARG --build-arg VERSION=${GITHUB_SHA} -t app . &&\
26-
docker tag app "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
27-
docker push "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
28-
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
29-
docker tag app "${DOCKER_APP_IMAGE_NAME}:latest" &&\
30-
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\
31-
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; then
32-
cd `mktemp -d` &&\
33-
echo "${HASADNA_K8S_DEPLOY_KEY}" > hasadna_k8s_deploy_key &&\
34-
chmod 400 hasadna_k8s_deploy_key &&\
35-
export GIT_SSH_COMMAND="ssh -i `pwd`/hasadna_k8s_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\
36-
git clone [email protected]:hasadna/hasadna-k8s.git &&\
37-
cd hasadna-k8s &&\
38-
python update_yaml.py '{"mapSearchImage":"'"${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/openbus/values-hasadna-auto-updated.yaml &&\
39-
git config --global user.name "Open Bus Map Search CI" &&\
40-
git config --global user.email "open-bus-map-search-ci@localhost" &&\
41-
git add apps/openbus/values-hasadna-auto-updated.yaml && git commit -m "automatic update of open bus map search" &&\
42-
git push origin master
11+
- uses: actions/checkout@v4
12+
- name: Get Commit Hash and generate Version File
13+
run: echo "$(git rev-parse --short HEAD)" >> public/hash.txt
14+
- env:
15+
DOCKER_APP_IMAGE_NAME: 'ghcr.io/hasadna/open-bus-map-search/open-bus-map-search'
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
HASADNA_K8S_DEPLOY_KEY: ${{ secrets.HASADNA_K8S_DEPLOY_KEY }}
18+
run: |
19+
echo "${GITHUB_TOKEN}" | docker login ghcr.io -u hasadna --password-stdin &&\
20+
if docker pull "${DOCKER_APP_IMAGE_NAME}:latest"; then
21+
CACHE_FROM_ARG="--cache-from ${DOCKER_APP_IMAGE_NAME}:latest"
22+
else
23+
CACHE_FROM_ARG=""
24+
fi &&\
25+
docker build $CACHE_FROM_ARG --build-arg VERSION=${GITHUB_SHA} -t app . &&\
26+
docker tag app "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
27+
docker push "${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}" &&\
28+
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
29+
docker tag app "${DOCKER_APP_IMAGE_NAME}:latest" &&\
30+
docker push "${DOCKER_APP_IMAGE_NAME}:latest" &&\
31+
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; then
32+
cd `mktemp -d` &&\
33+
echo "${HASADNA_K8S_DEPLOY_KEY}" > hasadna_k8s_deploy_key &&\
34+
chmod 400 hasadna_k8s_deploy_key &&\
35+
export GIT_SSH_COMMAND="ssh -i `pwd`/hasadna_k8s_deploy_key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" &&\
36+
git clone [email protected]:hasadna/hasadna-k8s.git &&\
37+
cd hasadna-k8s &&\
38+
python update_yaml.py '{"mapSearchImage":"'"${DOCKER_APP_IMAGE_NAME}:${GITHUB_SHA}"'"}' apps/openbus/values-hasadna-auto-updated.yaml &&\
39+
git config --global user.name "Open Bus Map Search CI" &&\
40+
git config --global user.email "open-bus-map-search-ci@localhost" &&\
41+
git add apps/openbus/values-hasadna-auto-updated.yaml && git commit -m "automatic update of open bus map search" &&\
42+
git push origin master
43+
fi
4344
fi
44-
fi

.github/workflows/complaint.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@ jobs:
55
timeout-minutes: 60
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v3
9-
- run: npm run docker:build
10-
working-directory: src/complaint
11-
- run: npm run docker:run
12-
working-directory: src/complaint
13-
- uses: actions/upload-artifact@v4
14-
if: always()
15-
with:
16-
name: playwright-trace
17-
path: src/complaint/traces
18-
retention-days: 30\
19-
- uses: shallwefootball/s3-upload-action@master
20-
name: Upload trace to S3
21-
if: always()
22-
id: s3-trace
23-
continue-on-error: true
24-
with:
25-
aws_key_id: ${{ secrets.AWS_KEY_ID }}
26-
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
27-
aws_bucket: noam-gaash.co.il
28-
source_dir: src/complaint/traces
29-
destination_dir: ${{ github.run_id }}/open-bus/complaint
30-
- name: output link to report to the trace
31-
if: always() && steps.s3-trace.outcome == 'success'
32-
run: echo "link to trace - https://trace.playwright.dev/?trace=https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/complaint/trace.zip" >> $GITHUB_STEP_SUMMARY
8+
- uses: actions/checkout@v4
9+
- run: npm run docker:build
10+
working-directory: src/complaint
11+
- run: npm run docker:run
12+
working-directory: src/complaint
13+
- uses: actions/upload-artifact@v4
14+
if: always()
15+
with:
16+
name: playwright-trace
17+
path: src/complaint/traces
18+
retention-days: 30\
19+
- uses: shallwefootball/s3-upload-action@master
20+
name: Upload trace to S3
21+
if: always()
22+
id: s3-trace
23+
continue-on-error: true
24+
with:
25+
aws_key_id: ${{ secrets.AWS_KEY_ID }}
26+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
27+
aws_bucket: noam-gaash.co.il
28+
source_dir: src/complaint/traces
29+
destination_dir: ${{ github.run_id }}/open-bus/complaint
30+
- name: output link to report to the trace
31+
if: always() && steps.s3-trace.outcome == 'success'
32+
run: echo "link to trace - https://trace.playwright.dev/?trace=https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/complaint/trace.zip" >> $GITHUB_STEP_SUMMARY

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ env:
1111

1212
jobs:
1313
test-with-coverage:
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717
- name: Use Node.js
18-
uses: actions/setup-node@v3
18+
uses: actions/setup-node@v4
1919
with:
20-
node-version: 18
20+
node-version: 20
2121
- name: Run install
2222
run: npm ci
2323
- run: npx playwright install

.github/workflows/deploy-preview.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
11
on:
2-
workflow_run:
3-
workflows: ["Build"]
4-
types:
5-
- completed
6-
2+
workflow_run:
3+
workflows: ['Build']
4+
types:
5+
- completed
6+
77
jobs:
88
deploy-to-s3:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212

1313
- name: Download dist-build artifact
14-
uses: dawidd6/action-download-artifact@v6
14+
uses: dawidd6/action-download-artifact@v9
1515
with:
16-
workflow: 'Build'
17-
workflow_conclusion: success
18-
github_token: ${{ secrets.GITHUB_TOKEN }}
19-
run_id: ${{ github.event.workflow_run.id }}
20-
run_number: ${{ github.event.workflow_run.run_number }}
21-
name: dist-build
22-
path: .
16+
workflow: 'Build'
17+
workflow_conclusion: success
18+
github_token: ${{ secrets.GITHUB_TOKEN }}
19+
run_id: ${{ github.event.workflow_run.id }}
20+
run_number: ${{ github.event.workflow_run.run_number }}
21+
name: dist-build
22+
path: .
2323

2424
- name: Download dist-storybook artifact
25-
uses: dawidd6/action-download-artifact@v6
25+
uses: dawidd6/action-download-artifact@v9
2626
with:
27-
workflow: 'Build'
28-
workflow_conclusion: success
29-
github_token: ${{ secrets.GITHUB_TOKEN }}
30-
run_id: ${{ github.event.workflow_run.id }}
31-
run_number: ${{ github.event.workflow_run.run_number }}
32-
name: dist-storybook
33-
path: storybook
27+
workflow: 'Build'
28+
workflow_conclusion: success
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
run_id: ${{ github.event.workflow_run.id }}
31+
run_number: ${{ github.event.workflow_run.run_number }}
32+
name: dist-storybook
33+
path: storybook
3434

3535
- name: Download pr number
36-
uses: dawidd6/action-download-artifact@v6
36+
uses: dawidd6/action-download-artifact@v9
3737
with:
38-
workflow: 'Build'
39-
workflow_conclusion: success
40-
github_token: ${{ secrets.GITHUB_TOKEN }}
41-
run_id: ${{ github.event.workflow_run.id }}
42-
run_number: ${{ github.event.workflow_run.run_number }}
43-
name: pr_number
44-
path: .
38+
workflow: 'Build'
39+
workflow_conclusion: success
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
run_id: ${{ github.event.workflow_run.id }}
42+
run_number: ${{ github.event.workflow_run.run_number }}
43+
name: pr_number
44+
path: .
4545

4646
- name: Read PR number
4747
id: read-pr
@@ -58,11 +58,11 @@ jobs:
5858
aws_key_id: ${{ secrets.AWS_KEY_ID }}
5959
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6060
aws_bucket: noam-gaash.co.il
61-
source_dir: . # Upload the root directory
61+
source_dir: . # Upload the root directory
6262
destination_dir: ${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.run_number }}
6363

6464
- name: find comment
65-
uses: peter-evans/find-comment@v1
65+
uses: peter-evans/find-comment@v3
6666
if: env.PR_NUMBER
6767
id: fc
6868
with:
@@ -71,7 +71,7 @@ jobs:
7171
body-includes: 'Preview'
7272

7373
- name: update comment
74-
uses: peter-evans/create-or-update-comment@v1
74+
uses: peter-evans/create-or-update-comment@v4
7575
if: steps.fc.outputs.comment-id
7676
with:
7777
comment-id: ${{ steps.fc.outputs.comment-id }}
@@ -82,7 +82,7 @@ jobs:
8282
Test Report (if available): 'https://s3.amazonaws.com/noam-gaash.co.il/${{ github.event.workflow_run.id }}/open-bus/${{ github.event.workflow_run.head_sha }}/test-results/index.html'
8383
8484
- name: create comment
85-
uses: peter-evans/create-or-update-comment@v1
85+
uses: peter-evans/create-or-update-comment@v4
8686
if: steps.fc.outputs.comment-id == ''
8787
with:
8888
issue-number: ${{ env.PR_NUMBER }}

.github/workflows/docker_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ on:
99

1010
jobs:
1111
docker-build:
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
- name: check the dockerfile
1616
run: |
1717
docker build .

0 commit comments

Comments
 (0)