Spaces:
Sleeping
Sleeping
feat: new Github Action for push and release!
Browse filestest modify
fix: build action
fix: checkout@v4 buildx@v3
fix: change dest to myimage.tar
fix:attempQAQ
应该能行了吧
fix: trigger for GA change to main
.github/workflows/Build_Docker.yml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build Docker when Push
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- "main"
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
docker:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
steps:
|
12 |
+
- name: Checkout
|
13 |
+
uses: actions/checkout@v4
|
14 |
+
|
15 |
+
- name: Set commit SHA
|
16 |
+
run: echo "COMMIT_SHA=$(echo ${{ github.sha }} | cut -c 1-7)" >> ${GITHUB_ENV}
|
17 |
+
|
18 |
+
- name: Set up QEMU
|
19 |
+
uses: docker/setup-qemu-action@v2
|
20 |
+
|
21 |
+
- name: Set up Docker Buildx
|
22 |
+
uses: docker/setup-buildx-action@v3
|
23 |
+
|
24 |
+
- name: Login to GitHub Container Registry
|
25 |
+
uses: docker/login-action@v2
|
26 |
+
with:
|
27 |
+
registry: ghcr.io
|
28 |
+
username: ${{ github.repository_owner }}
|
29 |
+
password: ${{ secrets.MY_TOKEN }}
|
30 |
+
|
31 |
+
- name: Owner names
|
32 |
+
run: |
|
33 |
+
GITOWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
34 |
+
echo "GITOWNER=$GITOWNER" >> ${GITHUB_ENV}
|
35 |
+
|
36 |
+
- name: Build and export
|
37 |
+
uses: docker/build-push-action@v5
|
38 |
+
with:
|
39 |
+
context: .
|
40 |
+
platforms: linux/amd64,linux/arm64
|
41 |
+
push: false
|
42 |
+
tags: |
|
43 |
+
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:latest
|
44 |
+
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:${{ github.sha }}
|
45 |
+
outputs: type=oci,dest=/tmp/myimage-${{ env.COMMIT_SHA }}.tar
|
46 |
+
|
47 |
+
- name: Upload artifact
|
48 |
+
uses: actions/upload-artifact@v3
|
49 |
+
with:
|
50 |
+
name: chuanhuchatgpt-${{ env.COMMIT_SHA }}
|
51 |
+
path: /tmp/myimage-${{ env.COMMIT_SHA }}.tar
|
.github/workflows/{Docker Images.yml → Release_docker.yml}
RENAMED
@@ -1,47 +1,47 @@
|
|
1 |
-
name: Build and
|
2 |
|
3 |
on:
|
4 |
-
|
5 |
-
|
6 |
-
- "main"
|
7 |
|
8 |
jobs:
|
9 |
docker:
|
10 |
runs-on: ubuntu-latest
|
11 |
steps:
|
12 |
-
-
|
13 |
-
name: Checkout
|
14 |
uses: actions/checkout@v3
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
run: |
|
18 |
-
echo "
|
19 |
-
|
20 |
-
|
21 |
uses: docker/setup-qemu-action@v2
|
22 |
-
|
23 |
-
|
24 |
uses: docker/setup-buildx-action@v2
|
25 |
-
|
26 |
-
|
27 |
uses: docker/login-action@v2
|
28 |
with:
|
29 |
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
30 |
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
31 |
-
|
32 |
-
|
33 |
uses: docker/login-action@v2
|
34 |
with:
|
35 |
registry: ghcr.io
|
36 |
username: ${{ github.repository_owner }}
|
37 |
password: ${{ secrets.MY_TOKEN }}
|
38 |
-
|
39 |
-
|
40 |
run: |
|
41 |
GITOWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
42 |
echo "GITOWNER=$GITOWNER" >> ${GITHUB_ENV}
|
43 |
-
|
44 |
-
|
45 |
uses: docker/build-push-action@v4
|
46 |
with:
|
47 |
context: .
|
@@ -49,6 +49,6 @@ jobs:
|
|
49 |
push: true
|
50 |
tags: |
|
51 |
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:latest
|
52 |
-
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:${{ env.
|
53 |
${{ secrets.DOCKERHUB_USERNAME }}/chuanhuchatgpt:latest
|
54 |
-
${{ secrets.DOCKERHUB_USERNAME }}/chuanhuchatgpt:${{ env.
|
|
|
1 |
+
name: Build and Push Docker when Release
|
2 |
|
3 |
on:
|
4 |
+
release:
|
5 |
+
types: [published]
|
|
|
6 |
|
7 |
jobs:
|
8 |
docker:
|
9 |
runs-on: ubuntu-latest
|
10 |
steps:
|
11 |
+
- name: Checkout
|
|
|
12 |
uses: actions/checkout@v3
|
13 |
+
with:
|
14 |
+
ref: ${{ github.event.release.target_commitish }}
|
15 |
+
|
16 |
+
- name: Set release tag
|
17 |
run: |
|
18 |
+
echo "RELEASE_TAG=${{ github.event.release.tag_name }}" >> ${GITHUB_ENV}
|
19 |
+
|
20 |
+
- name: Set up QEMU
|
21 |
uses: docker/setup-qemu-action@v2
|
22 |
+
|
23 |
+
- name: Set up Docker Buildx
|
24 |
uses: docker/setup-buildx-action@v2
|
25 |
+
|
26 |
+
- name: Login to Docker Hub
|
27 |
uses: docker/login-action@v2
|
28 |
with:
|
29 |
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
30 |
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
31 |
+
|
32 |
+
- name: Login to GitHub Container Registry
|
33 |
uses: docker/login-action@v2
|
34 |
with:
|
35 |
registry: ghcr.io
|
36 |
username: ${{ github.repository_owner }}
|
37 |
password: ${{ secrets.MY_TOKEN }}
|
38 |
+
|
39 |
+
- name: Owner names
|
40 |
run: |
|
41 |
GITOWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
42 |
echo "GITOWNER=$GITOWNER" >> ${GITHUB_ENV}
|
43 |
+
|
44 |
+
- name: Build and push
|
45 |
uses: docker/build-push-action@v4
|
46 |
with:
|
47 |
context: .
|
|
|
49 |
push: true
|
50 |
tags: |
|
51 |
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:latest
|
52 |
+
ghcr.io/${{ env.GITOWNER }}/chuanhuchatgpt:${{ env.RELEASE_TAG }}
|
53 |
${{ secrets.DOCKERHUB_USERNAME }}/chuanhuchatgpt:latest
|
54 |
+
${{ secrets.DOCKERHUB_USERNAME }}/chuanhuchatgpt:${{ env.RELEASE_TAG }}
|