-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (70 loc) · 2.83 KB
/
typescript-node-nightly.yml
File metadata and controls
81 lines (70 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: TypeScript Node - Nightly
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'source/typescript-node/Dockerfile'
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: STAGING
permissions:
contents: read
packages: write
env:
REPO: typescript-node
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # 3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # 3.12.0
- name: Login to Docker Hub
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # 3.6.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # 3.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: tag_builder
name: Generate build tags
run: |
TIMESTAMP=$(date +'%Y%m%d')
SHA=$(git rev-parse --short HEAD)
echo "build_tag=nightly-${TIMESTAMP}-${SHA}" >> $GITHUB_OUTPUT
echo "Generated build tag: nightly-${TIMESTAMP}-${SHA}"
# expose a separate tag for testing purposes
echo "test_tag=nightly-test-${TIMESTAMP}-${SHA}" >> $GITHUB_OUTPUT
echo "Generated test tag: nightly-test-${TIMESTAMP}-${SHA}"
- name: Build image for testing
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
with:
context: source/typescript-node
platforms: linux/amd64
push: false
load: true
tags: |
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO }}:${{ steps.tag_builder.outputs.test_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run test
run: |
TEST_IMAGE="${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO }}:${{ steps.tag_builder.outputs.test_tag }}"
echo "Running smoke test against $TEST_IMAGE"
docker run --rm "$TEST_IMAGE" node -v
- name: Build & Push image to registries
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
with:
context: source/typescript-node
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ vars.DOCKERHUB_USERNAME }}/${{ env.REPO }}:${{ steps.tag_builder.outputs.build_tag }}
ghcr.io/${{ github.repository_owner }}/${{ env.REPO }}:${{ steps.tag_builder.outputs.build_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max