-
Notifications
You must be signed in to change notification settings - Fork 16
109 lines (87 loc) · 3.67 KB
/
devcontainer.yml
File metadata and controls
109 lines (87 loc) · 3.67 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Create dev container
on:
# run every Monday at 4:00 AM
schedule:
- cron: "0 4 * * 1"
# schedule manually
workflow_dispatch:
inputs:
# On workflow dispatch, `branch` is selected by default
# You can access it in `github.ref_name`
tag_name:
description: "Tag name for the container"
required: true
default: "latest"
container_repository_branch:
description: "Branch of the container repository"
required: true
default: "main"
jobs:
create-container:
if: github.event_name != 'schedule' || github.repository_owner == 'geo-engine'
runs-on: ubuntu-24.04
permissions:
contents: read
env:
TAG_NAME: latest
CONTAINER_REPOSITORY_BRANCH: main
CONTAINER_NAME: devcontainer
steps:
- name: Modify TAG_NAME if on `tag_name` is set on `workflow_dispatch`
if: github.event.inputs.tag_name != ''
run: |
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- name: Modify CONTAINER_REPOSITORY_BRANCH if on `container_repository_branch` is set on `workflow_dispatch`
if: github.event.inputs.container_repository_branch != ''
run: |
echo "CONTAINER_REPOSITORY_BRANCH=${{ github.event.inputs.container_repository_branch }}" >> $GITHUB_ENV
- name: Checkout container files
uses: actions/checkout@v6
with:
repository: geo-engine/geoengine-container
ref: ${{ env.CONTAINER_REPOSITORY_BRANCH }}
ssh-key: ${{ secrets.CONTAINER_GITHUB_TOKEN }}
path: "container"
- name: Login to quay.io
run: podman login -u="geoengine+bot" -p="${{secrets.QUAY_IO_TOKEN}}" quay.io
- name: Build with podman
run: |
podman build \
--tag ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} \
.
working-directory: container/${{env.CONTAINER_NAME}}
- name: Push image to quay.io
run: podman push ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:${{env.TAG_NAME}}
- name: Push latest with date
if: env.TAG_NAME == 'latest'
run: podman push ${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:${{env.TAG_NAME}}-$(date +'%Y-%m-%d')
- name: Build with podman (extended)
run: |
podman build \
-f Dockerfile.extended \
--build-arg BASE_IMAGE=${{env.CONTAINER_NAME}}:${{env.TAG_NAME}} \
--tag ${{env.CONTAINER_NAME}}:extended-${{env.TAG_NAME}} \
.
working-directory: container/${{env.CONTAINER_NAME}}
- name: Push image to quay.io (extended)
run: podman push ${{env.CONTAINER_NAME}}:extended-${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:extended-${{env.TAG_NAME}}
- name: Push latest with date (extended)
if: env.TAG_NAME == 'latest'
run: podman push ${{env.CONTAINER_NAME}}:extended-${{env.TAG_NAME}} quay.io/geoengine/${{env.CONTAINER_NAME}}:extended-${{env.TAG_NAME}}-$(date +'%Y-%m-%d')
notify-slack-on-failure:
name: Post to a Slack channel in case of failure
needs: create-container
if: always()
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Post to a Slack channel
if: ${{ needs.create-container.result == 'failure' }}
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
channel-id: "geoengine-dev-core"
slack-message: "⚠️ The workflow ${{ github.workflow }} in the repository ${{ github.event.repository.name }} FAILED!"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}