-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (41 loc) · 1.31 KB
/
Copy pathdocker-push-workspace.yml
File metadata and controls
48 lines (41 loc) · 1.31 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
# Build and push workspace-api image to Docker Hub.
# Trigger: manual (workflow_dispatch) or push of tag 'workspace-v*'.
# Repository secrets: DOCKERHUB_USERNAME (e.g. manishiitg), DOCKERHUB_TOKEN.
name: Docker push workspace-api
on:
workflow_dispatch:
push:
tags:
- 'workspace-v*'
env:
IMAGE: manishiitg/workspace-api
jobs:
push:
name: Build and push workspace-api
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set tags
id: tags
run: |
echo "latest=${{ env.IMAGE }}:latest" >> $GITHUB_OUTPUT
if [[ "${{ github.ref }}" == refs/tags/workspace-v* ]]; then
echo "version=${{ env.IMAGE }}:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "version=${{ env.IMAGE }}:latest" >> $GITHUB_OUTPUT
fi
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./workspace
file: ./workspace/Dockerfile
push: true
tags: |
${{ steps.tags.outputs.latest }}
${{ steps.tags.outputs.version }}