Skip to content

Commit a553b70

Browse files
author
Dominick Brasileiro
committed
chore: add github actions workflows
1 parent 51dbdfe commit a553b70

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
tags: [v*]
6+
7+
env:
8+
image: ghcr.io/${{ github.repository }}
9+
tagged_image: ghcr.io/${{ github.repository }}:$(echo ${GITHUB_REF_NAME#v})
10+
11+
jobs:
12+
docker-image:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: "actions/checkout@v3"
16+
- name: Configure Registry
17+
run: docker login ghcr.io -u ${{ github.repository_owner }} --password ${{ github.token }}
18+
- name: Build the image
19+
run: docker build . --file Dockerfile --tag ${{ env.image }}
20+
- name: Tag the image
21+
run: docker tag ${{ env.image }} ${{ env.tagged_image }}
22+
- name: Push the tagged image
23+
run: docker push ${{ env.tagged_image }}
24+
- name: Push the latest image
25+
run: docker push ${{ env.image }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: GitHub Release
2+
3+
on:
4+
push:
5+
tags: [v*]
6+
7+
jobs:
8+
build-and-create-release:
9+
permissions: write-all
10+
name: Build and Create Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/setup-go@v3
14+
with:
15+
go-version: '1.19'
16+
- uses: actions/checkout@v3
17+
- name: Install dependencies
18+
run: |
19+
make install_deps
20+
- name: Build binaries
21+
run: |
22+
./build.sh
23+
- name: Create release
24+
env:
25+
GITHUB_TOKEN: ${{ github.token }}
26+
run: |
27+
gh release create \
28+
--title "$GITHUB_REF_NAME" \
29+
--notes "" \
30+
"$GITHUB_REF_NAME" \
31+
./build/*

build.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
platforms="windows/386 windows/amd64 windows/arm64 darwin/amd64 darwin/arm64 linux/amd64 linux/arm64"
2+
package_name="go-reverse-proxy"
3+
4+
rm -rf build
5+
mkdir -p build
6+
cd build
7+
8+
for platform in $platforms; do
9+
echo "Building $platform..."
10+
platform_split=(${platform//\// })
11+
GOOS=${platform_split[0]}
12+
GOARCH=${platform_split[1]}
13+
14+
output_name=$package_name'-'$GOOS'-'$GOARCH.tar.gz
15+
binary_name=$package_name
16+
17+
if [ $GOOS = "windows" ]; then
18+
binary_name+='.exe'
19+
fi
20+
21+
env GOOS=$GOOS GOARCH=$GOARCH go build -o $binary_name ..
22+
tar -czf $output_name $binary_name
23+
rm $binary_name
24+
done

0 commit comments

Comments
 (0)