-
Notifications
You must be signed in to change notification settings - Fork 12.3k
75 lines (71 loc) · 2.68 KB
/
build-ci-container-windows.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
name: Build Windows CI Container
permissions:
contents: read
on:
push:
branches:
- main
paths:
- .github/workflows/build-ci-container-windows.yml
- '.github/workflows/containers/github-action-ci-windows/**'
pull_request:
branches:
- main
paths:
- .github/workflows/build-ci-container-windows.yml
- '.github/workflows/containers/github-action-ci-windows/**'
jobs:
build-ci-container-windows:
if: github.repository_owner == 'llvm'
runs-on: windows-2019
outputs:
container-name: ${{ steps.vars.outputs.container-name }}
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
container-filename: ${{ steps.vars.outputs.container-filename }}
steps:
- name: Checkout LLVM
uses: actions/checkout@v4
with:
sparse-checkout: .github/workflows/containers/github-action-ci-windows
- name: Write Variables
id: vars
run: |
$tag = [int64](Get-Date -UFormat %s)
$container_name="ghcr.io/$env:GITHUB_REPOSITORY_OWNER/ci-windows-2019"
echo "container-name=${container_name}" >> $env:GITHUB_OUTPUT
echo "container-name-tag=${container_name}:${tag}" >> $env:GITHUB_OUTPUT
echo "container-filename=ci-windows-${tag}.tar" >> $env:GITHUB_OUTPUT
- name: Build Container
working-directory: .github/workflows/containers/github-action-ci-windows
run: |
docker build -t ${{ steps.vars.outputs.container-name-tag }} .
- name: Save container image
run: |
docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
- name: Upload container image
uses: actions/upload-artifact@v4
with:
name: container
path: ${{ steps.vars.outputs.container-filename }}
retention-days: 14
push-ci-container:
if: github.event_name == 'push'
needs:
- build-ci-container-windows
permissions:
packages: write
runs-on: windows-2019
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download container
uses: actions/download-artifact@v4
with:
name: container
- name: Push Container
run: |
docker load -i ${{ needs.build-ci-container.outptus.container-filename }}
docker tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
docker login -u ${{ github.actor }} -p $env:GITHUB_TOKEN ghcr.io
docker push ${{ needs.build-ci-container.outputs.container-name-tag }}
docker push ${{ needs.build-ci-container.outputs.container-name }}:latest