-
-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (79 loc) · 2.76 KB
/
ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Ubuntu
on:
push:
paths:
- .github/workflows/ubuntu.yml
- shell/**
- .dockerignore
- .ssh.sh
- ubuntu.Dockerfile
pull_request:
paths:
- .github/workflows/ubuntu.yml
- shell/**
- .dockerignore
- .ssh.sh
- ubuntu.Dockerfile
jobs:
verify:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -f ubuntu.Dockerfile -t kbuley/basedevcontainer .
publish:
needs: [verify]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: kbuley
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- uses: docker/login-action@v3
with:
registry: quay.io
username: kbuley+github
password: ${{ secrets.QUAY_PASSWORD }}
- name: Set variables
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
run: |
BRANCH=${GITHUB_REF#refs/heads/}
TAG=${GITHUB_REF#refs/tags/}
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "create=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
if [ "$TAG" != "$GITHUB_REF" ]; then
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "ubuntu_version=$TAG-ubuntu" >> $GITHUB_OUTPUT
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
elif [ "$BRANCH" = "main" ]; then
echo "version=latest" >> $GITHUB_OUTPUT
echo "ubuntu_version=ubuntu" >> $GITHUB_OUTPUT
echo "platforms=linux/amd64,linux/arm64,linux/arm64/v8" >> $GITHUB_OUTPUT
else
echo "version=$BRANCH" >> $GITHUB_OUTPUT
echo "ubuntu_version=$BRANCH-ubuntu" >> $GITHUB_OUTPUT
echo "platforms=linux/amd64,linux/arm64,linux/arm64/v8" >> $GITHUB_OUTPUT
fi
- name: Build and push final image
uses: docker/build-push-action@v5
with:
file: ubuntu.Dockerfile
platforms: ${{ steps.vars.outputs.platforms }}
build-args: |
CREATED=${{ steps.vars.outputs.created }}
COMMIT=${{ steps.vars.outputs.commit }}
VERSION=${{ steps.vars.outputs.version }}
tags: |
kbuley/basedevcontainer:${{ steps.vars.outputs.version }}
kbuley/basedevcontainer:${{ steps.vars.outputs.ubuntu_version }}
quay.io/kbuley/basedevcontainer:${{ steps.vars.outputs.version }}
quay.io/kbuley/basedevcontainer:${{ steps.vars.outputs.ubuntu_version }}
push: true