-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (57 loc) · 1.98 KB
/
Copy pathpush-docker-image.yml
File metadata and controls
64 lines (57 loc) · 1.98 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
name: Push Docker Image to Azure Container Registry
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'develop'
type: choice
options:
- develop
- staging
- production
- testing
jobs:
set-github-environment:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.set-env.outputs.target_env }}
steps:
- name: Set Environment
id: set-env
run: |
case "${{ inputs.environment }}" in
testing) echo "target_env=test" >> $GITHUB_OUTPUT ;;
develop) echo "target_env=dev" >> $GITHUB_OUTPUT ;;
staging) echo "target_env=stage" >> $GITHUB_OUTPUT ;;
production) echo "target_env=prod" >> $GITHUB_OUTPUT ;;
esac
build:
runs-on: ubuntu-latest
name: "Build"
needs: set-github-environment
concurrency:
group: build
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.environment }}
- uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKERHUB_REGISTRY }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: ${{ vars.DOCKERHUB_REGISTRY }}/workspaces-backend-v2:${{ needs.set-github-environment.outputs.environment }},
${{ vars.DOCKERHUB_REGISTRY }}/workspaces-backend-v2:${{github.sha}}