-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 2.19 KB
/
build.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
name: Build and Deploy VSCode base image
on:
push:
branches: [main]
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
max-parallel: 1
matrix:
image: [vscode]
include:
- image: base
directory: base
dockerfile: Dockerfile.debian
- image: vscode
directory: vscode
dockerfile: Dockerfile.vscode
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 3
- name: Check for changes
id: check_for_changes
run: |
echo "CHANGE_COUNT=$(git diff --name-only HEAD^ HEAD | grep '${{ matrix.directory }}' | wc -l)" >> "$GITHUB_OUTPUT"
- name: Info
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
run: |
echo "changes: ${{ steps.check_for_changes.outputs.CHANGE_COUNT }} event: ${{ github.event_name }}"
- name: Get version
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
id: version
run: |
echo "VERSION=$(cat ${{ matrix.directory }}/VERSION)" >> "$GITHUB_OUTPUT"
- name: Log in to the Container registry
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/setup-buildx-action@v2
- name: Build and push
if: steps.check_for_changes.outputs.CHANGE_COUNT != '0'
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ${{ matrix.directory }}
file: ${{ matrix.directory }}/${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/jumppad-labs/vscode:${{ matrix.image }}-${{ steps.version.outputs.VERSION }}