-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (84 loc) · 2.55 KB
/
publish.yaml
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
# Workflow for building and publishing this action's container image
name: Build and Publish
on:
push:
branches:
- main
- releases/*
pull_request: {}
release:
types:
- published
permissions:
contents: write
packages: write
jobs:
lint:
name: Lint, format and test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
node-modules-${{ runner.os }}
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive
- name: Format
run: yarn format:check
- name: Lint
run: yarn lint
- name: Test
run: yarn test
publish:
name: Publish
runs-on: ubuntu-latest
concurrency: ${{ github.ref }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/alwaysmeticulous/report-diffs-action
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Configure GHCR credentials
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker build
uses: docker/build-push-action@v3
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/alwaysmeticulous/report-diffs-action:cache
cache-to: type=registry,ref=ghcr.io/alwaysmeticulous/report-diffs-action:cache,mode=max
- name: Bump V1 tag
if: github.ref == 'refs/heads/releases/v1'
run: |
git fetch origin releases/v1 --tags
git tag --delete v1
git tag v1 origin/releases/v1
git push --tag --force