Skip to content

Commit fb07ce3

Browse files
committed
ci: add create tag wrokflows config.
1 parent a3a86df commit fb07ce3

File tree

2 files changed

+82
-3
lines changed

2 files changed

+82
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
name: Build and Deploy
1+
name: Build and Push
22

33
on:
44
push:
5-
tags:
6-
- v*
75
branches:
86
- main
97
paths-ignore:
108
- '**/*.md'
9+
- '**/*.yml'
1110

1211
jobs:
1312
build:

.github/workflows/tag.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
paths-ignore:
8+
- '**/*.md'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout zh-hans.react.dev code
16+
uses: actions/checkout@v4
17+
with:
18+
repository: reactjs/zh-hans.react.dev
19+
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
path: 'config'
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
registry-url: 'https://registry.npmjs.org'
30+
31+
- run: ls -al
32+
working-directory: config
33+
- run: ls -al
34+
35+
- run: node scripts.mjs
36+
working-directory: config
37+
38+
- run: ls -al
39+
40+
- run: cp config/Dockerfile ./
41+
42+
- name: Create dockerignore file.
43+
run: |
44+
cat > .dockerignore << EOF
45+
Dockerfile
46+
.dockerignore
47+
config
48+
node_modules
49+
npm-debug.log
50+
README.md
51+
.next
52+
.git
53+
EOF
54+
55+
- name: Setup QEMU
56+
uses: docker/setup-qemu-action@v3
57+
with:
58+
image: tonistiigi/binfmt:latest
59+
platforms: all
60+
61+
# Create Docker Image
62+
- name: Set up Docker Buildx
63+
uses: docker/setup-buildx-action@v3
64+
65+
- name: Login to Docker Hub
66+
uses: docker/login-action@v3
67+
with:
68+
username: ${{ secrets.DOCKER_USER }}
69+
password: ${{ secrets.DOCKER_PASSWORD }}
70+
71+
- name: Build and push image:latest
72+
uses: docker/build-push-action@v6
73+
with:
74+
push: true
75+
context: .
76+
platforms: linux/amd64,linux/arm64
77+
tags: |
78+
${{ secrets.DOCKER_USER }}/zh-hans.react.dev:latest
79+
${{ secrets.DOCKER_USER }}/zh-hans.react.dev:${{ github.ref_name }}
80+

0 commit comments

Comments
 (0)