You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: Create and publish devcontainer Docker image
2
+
3
+
on:
4
+
push:
5
+
branches:
6
+
- "main"
7
+
paths:
8
+
- ".devcontainer/Dockerfile"
9
+
- ".github/workflows/CreateDevcontainerImage.yml"
10
+
- "rust-toolchain.toml"
11
+
12
+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
13
+
env:
14
+
REGISTRY: ghcr.io
15
+
IMAGE_NAME: ${{ github.repository }}-devcontainer
16
+
USER: vscode
17
+
GROUP: vscode
18
+
LLVM_VERSION: 17
19
+
RUST_TOOLCHAIN_DEFAULT: 1.81.0
20
+
RUST_TOOLCHAIN_FILE: rust-toolchain.toml
21
+
22
+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
23
+
jobs:
24
+
build-and-push-image:
25
+
runs-on: ubuntu-latest
26
+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
27
+
permissions:
28
+
contents: read
29
+
packages: write
30
+
31
+
steps:
32
+
- name: Checkout repository
33
+
uses: actions/checkout@v4
34
+
35
+
- name: Read Rust toolchain version from ${{ env.RUST_TOOLCHAIN_FILE }}
36
+
id: toolchain
37
+
run: |
38
+
version=$(cat ${{ env.RUST_TOOLCHAIN_FILE }} | sed -n '/\[toolchain\]/,/^\[/{/^\s*channel = /s/[^"]*"\([^"]*\)".*/\1/p}')
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
44
+
- name: Log in to the Container registry
45
+
uses: docker/login-action@v3
46
+
with:
47
+
registry: ${{ env.REGISTRY }}
48
+
username: ${{ github.actor }}
49
+
password: ${{ secrets.GITHUB_TOKEN }}
50
+
51
+
- name: Extract metadata (tags, labels) for Docker
0 commit comments