Skip to content

Commit 04b345e

Browse files
committed
Migrate to github actions
1 parent 13f9546 commit 04b345e

File tree

4 files changed

+93
-76
lines changed

4 files changed

+93
-76
lines changed

.github/workflows/ci-pipeline.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
build_binaries:
12+
name: Build Binaries
13+
runs-on: ubuntu-20.04
14+
15+
steps:
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: 1.22.8
20+
21+
- name: Checkout Code
22+
uses: actions/checkout@v4
23+
24+
- name: Build
25+
run: |
26+
export PATH="$GOBIN:$PATH"
27+
. build.sh
28+
env:
29+
ARTIFACTS: ${{ runner.temp }}/artifacts
30+
shell: bash
31+
32+
- name: Upload Build Artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: binaries
36+
path: ${{ runner.temp }}/artifacts/binaries
37+
38+
linux:
39+
name: Linux
40+
runs-on: ubuntu-20.04
41+
needs: build_binaries
42+
43+
steps:
44+
- name: Checkout Code
45+
uses: actions/checkout@v4
46+
47+
- name: Download Build Artifacts
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: binaries
51+
path: artifacts
52+
53+
- name: Run Docker Tests
54+
run: . run-docker-tests-linux.sh
55+
shell: bash
56+
57+
- name: Build Docker Images
58+
run: ./build-images-linux.sh
59+
env:
60+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
61+
shell: bash
62+
63+
windows:
64+
name: Windows
65+
runs-on: windows-2022
66+
needs: build_binaries
67+
68+
steps:
69+
- name: Checkout Code
70+
uses: actions/checkout@v4
71+
72+
- name: Download Build Artifacts
73+
uses: actions/download-artifact@v3
74+
with:
75+
name: binaries
76+
path: artifacts
77+
78+
# Uncomment this step if needed once windows docker tests are implemented
79+
# - name: Run Docker Tests (Windows)
80+
# run: .\run-docker-tests-windows.sh
81+
# shell: bash
82+
83+
- name: Build Docker Images
84+
run: .\build-images-windows.sh
85+
env:
86+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
87+
shell: bash

azure-pipelines.yml

-70
This file was deleted.

build-images-linux.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ OUTPUT="type=local,dest=local"
1212
TAGS=
1313
TAGS_ALPINE=
1414

15-
if [[ "${BUILD_SOURCEBRANCH}" == "refs/heads/master" ]]; then
15+
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
1616
echo "Building and pushing CI images"
1717

1818
docker login -u lucaslorentz -p "$DOCKER_PASSWORD"
@@ -22,8 +22,8 @@ if [[ "${BUILD_SOURCEBRANCH}" == "refs/heads/master" ]]; then
2222
TAGS_ALPINE="-t lucaslorentz/caddy-docker-proxy:ci-alpine"
2323
fi
2424

25-
if [[ "${BUILD_SOURCEBRANCH}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
26-
RELEASE_VERSION=$(echo $BUILD_SOURCEBRANCH | cut -c11-)
25+
if [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
26+
RELEASE_VERSION=$(echo $GITHUB_REF | cut -c11-)
2727

2828
echo "Releasing version ${RELEASE_VERSION}..."
2929

build-images-windows.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ docker build -f Dockerfile-nanoserver . \
1414
--build-arg NANOSERVER_VERSION=ltsc2022 \
1515
-t lucaslorentz/caddy-docker-proxy:ci-nanoserver-ltsc2022
1616

17-
if [[ "${BUILD_SOURCEBRANCH}" == "refs/heads/master" ]]; then
17+
if [[ "${GITHUB_REF}" == "refs/heads/master" ]]; then
1818
echo "Pushing CI images"
1919

2020
docker login -u lucaslorentz -p "$DOCKER_PASSWORD"
2121
docker push lucaslorentz/caddy-docker-proxy:ci-nanoserver-1809
2222
docker push lucaslorentz/caddy-docker-proxy:ci-nanoserver-ltsc2022
2323
fi
2424

25-
if [[ "${BUILD_SOURCEBRANCH}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
26-
RELEASE_VERSION=$(echo $BUILD_SOURCEBRANCH | cut -c11-)
25+
if [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then
26+
RELEASE_VERSION=$(echo $GITHUB_REF | cut -c11-)
2727

2828
echo "Releasing version ${RELEASE_VERSION}..."
2929

0 commit comments

Comments
 (0)