generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 2
46 lines (38 loc) · 1.22 KB
/
publish.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
name: Build and Publish Docker Image
on:
push:
paths-ignore:
- '**/*.md'
branches: [ main ]
tags: [ '*' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: winglang
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
run: |
docker build -t wing-action .
# For main branch, tag it as 'main'
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag wing-action ghcr.io/winglang/wing-github-action:main
docker push ghcr.io/winglang/wing-github-action:main
fi
# For new tags, tag the docker image with the same tag
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
docker tag wing-action ghcr.io/winglang/wing-github-action:$TAG
docker push ghcr.io/winglang/wing-github-action:$TAG
fi