forked from ktorio/ktor
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.25 KB
/
devcontainer.yml
File metadata and controls
88 lines (75 loc) · 2.25 KB
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
name: DevContainer
on:
pull_request:
branches: [ main ]
paths:
- .devcontainer/**
- .github/workflows/devcontainer.yml
- .nvmrc
push:
branches: [ main ]
paths:
- .devcontainer/**
- .github/workflows/devcontainer.yml
- .nvmrc
schedule:
- cron: '0 0 * * 6' # Every Saturday at 00:00
# Allow running manually
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ktorio/devcontainer
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
# If the event is a "pull_request", just test the image builds successfully and do not push it
PUSH_IMAGE: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
latest
{{date 'YYYYMMDD'}}
- name: Extract Node.js version
id: node-version
run: echo "result=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- name: Build image
id: build
uses: docker/build-push-action@v6
with:
push: ${{ env.PUSH_IMAGE }}
context: .devcontainer
target: dev
build-args: |
node_version=${{ steps.node-version.outputs.result }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
if: ${{ env.PUSH_IMAGE == 'true' }}
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.build.outputs.digest }}
push-to-registry: true