Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 3ef184a

Browse files
committed
github actions
1 parent 753a34d commit 3ef184a

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

.github/workflows/go.yml .github/workflows/build-release.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Go
1+
name: release build
22
on:
33
push:
44
tags:
@@ -39,6 +39,7 @@ jobs:
3939
run: |
4040
bash scripts/make_release.sh gzip amd64
4141
bash scripts/make_release.sh gzip amd64 purego
42+
bash scripts/make_release.sh gzip 386 purego
4243
bash scripts/make_release.sh gzip arm64 purego
4344
bash scripts/make_release.sh gzip darwin purego
4445
@@ -49,11 +50,11 @@ jobs:
4950
files: |
5051
cloud-torrent_linux_amd64.gz
5152
cloud-torrent_linux_amd64_static.gz
53+
cloud-torrent_linux_386_static.gz
5254
cloud-torrent_linux_arm64_static.gz
5355
cloud-torrent_darwin_amd64_static.gz
5456
prerelease: true
5557
draft: false
5658
body_path: gittaglogs.txt
5759
env:
5860
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-

.github/workflows/docker-push.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: docker build
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
paths:
7+
- "Dockerfile"
8+
- ".github/workflows/docker-push.yml"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout codebase
15+
uses: actions/checkout@v2
16+
17+
- name: Setup QEMU
18+
uses: docker/setup-qemu-action@v1
19+
20+
- name: Setup Docker Buildx
21+
uses: docker/setup-buildx-action@v1
22+
23+
- name: Login to DockerHub
24+
uses: docker/login-action@v1
25+
with:
26+
username: ${{ secrets.DOCKER_USERNAME }}
27+
password: ${{ secrets.DOCKER_PASSWORD }}
28+
29+
- name: Get tag to build
30+
id: tag
31+
run: |
32+
echo "Use tag: ${{ github.event.inputs.tag }}"
33+
echo ::set-output name=tag::${{ github.event.inputs.tag }}
34+
35+
- name: Determine whether to push to DockerHub
36+
if: github.event_name == 'workflow_dispatch'
37+
run: |
38+
echo "PUSH=true" >> $GITHUB_ENV
39+
40+
- name: Prepare environment variables
41+
id: prepare
42+
run: |
43+
echo ::set-output name=docker_platforms::linux/386,linux/amd64,linux/arm64
44+
echo ::set-output name=docker_image::boypt/cloud-torrent
45+
echo ::set-output name=docker_tag::${{ steps.tag.outputs.tag }}
46+
echo ::set-output name=docker_is_push::${PUSH:-false}
47+
48+
- name: Build tag & latest release
49+
run: |
50+
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
51+
--output "type=image,push=${{ steps.prepare.outputs.docker_is_push }}" \
52+
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.docker_tag }}" \
53+
--tag "${{ steps.prepare.outputs.docker_image }}:latest" \
54+
--build-arg TAG=${{ steps.prepare.outputs.docker_tag }} \
55+
--file Dockerfile .

0 commit comments

Comments
 (0)