-
Notifications
You must be signed in to change notification settings - Fork 53
42 lines (35 loc) · 1023 Bytes
/
dev.container_build.yaml
File metadata and controls
42 lines (35 loc) · 1023 Bytes
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
name: Dev Container Build
on:
push:
branches:
- "**"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set IMAGE_TAG
run: |
if [[ "${{ github.ref_name }}" == "test" ]]; then
echo "IMAGE_TAG=test" >> $GITHUB_ENV
else
echo "IMAGE_TAG=dev" >> $GITHUB_ENV
fi
- name: Login to Github Registry ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}/mage:$IMAGE_TAG .
- name: Push Image
if: github.ref =='refs/heads/test' || github.ref =='refs/heads/develop'
run: |
docker push ghcr.io/${{ github.repository }}/mage:$IMAGE_TAG