Skip to content

Commit

Permalink
build: update to Node.js 20 TDE-1090 (#991)
Browse files Browse the repository at this point in the history
#### Motivation

Keep our software up to date, and get any useful features, fixes, and
optimisations from new versions of dependencies.

#### Modification

1. Update the engine:

``` jq '.engines.node = "^20.13.1"' package.json | sponge package.json
```
2. Update the lock file:

   ``` npm install ```
3. Update the uses of `linz/action-typescript`:

   ```
for path in .github/workflows/*.y*ml; do yq --inplace '(.jobs.*.steps[]
| select(.uses == "linz/action-typescript*").with.node-version) =
"20.x"' "$path" done
   ```
4. Update Dockerfile reference

#### Checklist

- [ ] Tests updated (N/A)
- [ ] Docs updated (N/A)
- [x] Issue linked in Title
  • Loading branch information
l0b0 authored May 28, 2024
1 parent 1ddd8fb commit 87b7a0c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 40 deletions.
27 changes: 4 additions & 23 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: Build

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: linz/action-typescript@dee99184c4305aea6c380a52db9b2d7abaaa3e78 # v3

with:
node-version: 20.x
# Only build containers on branches otherwise container builds are duplicated deploy-nonprod-containers
- name: Set up Docker Buildx
if: ${{ github.ref != 'refs/heads/master' }}
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3

- name: Build container
if: ${{ github.ref != 'refs/heads/master' }}
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5
Expand All @@ -23,37 +21,28 @@ jobs:
build-args: |
GIT_HASH=${{ github.sha }}
GITHUB_RUN_ID=${{ github.run_id}}
deploy-nonprod-containers:
runs-on: ubuntu-latest

concurrency: deploy-dev-${{ github.ref }}

# On push to master when it is not a release!
if: ${{ github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'release:') }}

needs: ['build']

permissions:
id-token: write
contents: read
packages: write

env:
AWS_CI_ROLE: ${{ secrets.AWS_CI_ROLE }}

environment:
name: nonprod

steps:
- uses: linz/action-typescript@dee99184c4305aea6c380a52db9b2d7abaaa3e78 # v3

with:
node-version: 20.x
- name: Download actionlint
run: docker build --tag actionlint - < .github/workflows/actionlint.dockerfile

- name: Run actionlint to check workflow files
run: docker run --volume="${PWD}:/repo" --workdir=/repo actionlint -color

- name: Setup GIT version
id: version
run: |
Expand All @@ -62,42 +51,35 @@ jobs:
GIT_VERSION_MAJOR_MINOR=$(echo "$GIT_VERSION" | cut -d. -f1,2)
{ echo "version=${GIT_VERSION}"; echo "version_major=${GIT_VERSION_MAJOR}"; echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}"; } >> "$GITHUB_OUTPUT"
- name: Set up Docker Qemu
id: qemu
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3

- name: Docker meta
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5
with:
images: ${{ github.repository }}
labels: |
org.opencontainers.image.version=${{ steps.version.outputs.version }}
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure AWS Credentials
if: ${{env.AWS_CI_ROLE != ''}}
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_CI_ROLE }}

- name: Login to Amazon ECR
if: ${{env.AWS_CI_ROLE != ''}}
id: login-ecr
uses: aws-actions/amazon-ecr-login@2fc7aceee09e9e4a7105c0d060c656fad0b4f63d # v1

- name: Setup docker tags
id: tags
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
Expand All @@ -113,7 +95,6 @@ jobs:
tags.push('${{ steps.login-ecr.outputs.registry }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }}');
}
return tags.join(', ')
- name: Build and push container
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5
with:
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ on:
push:
branches:
- master

name: release-please
jobs:
release-please:
Expand All @@ -15,25 +14,22 @@ jobs:
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}

publish-release:
needs: release-please
runs-on: ubuntu-latest

environment:
name: prod

env:
AWS_CI_ROLE: ${{ secrets.AWS_CI_ROLE }}

permissions:
id-token: write
contents: read
packages: write
if: ${{ needs.release-please.outputs.release_created }}
steps:
- uses: linz/action-typescript@dee99184c4305aea6c380a52db9b2d7abaaa3e78 # v3

with:
node-version: 20.x
- name: Setup GIT version
id: version
run: |
Expand All @@ -42,42 +38,35 @@ jobs:
GIT_VERSION_MAJOR_MINOR=$(echo "$GIT_VERSION" | cut -d. -f1,2)
{ echo "version=${GIT_VERSION}"; echo "version_major=${GIT_VERSION_MAJOR}"; echo "version_major_minor=${GIT_VERSION_MAJOR_MINOR}"; } >> "$GITHUB_OUTPUT"
- name: Set up Docker Qemu
id: qemu
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3

- name: Docker meta
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5
with:
images: ${{ github.repository }}
labels: |
org.opencontainers.image.version=${{ steps.version.outputs.version }}
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure AWS Credentials
if: ${{ env.AWS_CI_ROLE != '' }}
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_CI_ROLE }}

- name: Login to Amazon ECR
if: ${{ env.AWS_CI_ROLE != '' }}
id: login-ecr
uses: aws-actions/amazon-ecr-login@2fc7aceee09e9e4a7105c0d060c656fad0b4f63d # v1

- name: Setup docker tags
id: tags
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
Expand All @@ -97,7 +86,6 @@ jobs:
tags.push('${{ steps.login-ecr.outputs.registry }}/${{ github.event.repository.name }}:${{ steps.version.outputs.version }}');
}
return tags.join(', ')
- name: Build and push container
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-slim@sha256:caea82ddba051b3f8157bf6d12c732d6f232b56af0dcefd4b51d8d9f5196e9dd
FROM node:20-slim@sha256:cffed8cd39d6a380434e6d08116d188c53e70611175cd5ec7700f93f32a935a6

RUN apt-get update && apt-get install openssh-client git -y

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"type": "module",
"engines": {
"node": ">=16.0.0"
"node": "^20.13.1"
},
"files": [
"build/src/**"
Expand Down

0 comments on commit 87b7a0c

Please sign in to comment.