-
Notifications
You must be signed in to change notification settings - Fork 6
53 lines (45 loc) · 1.49 KB
/
deploy-scancode.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
47
48
49
50
51
52
name: Create and publish scancode image
on:
push:
tags:
- "scancode-toolkit/v*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/scancode-toolkit
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Log in to the Container registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@05d22bf31770de02e20c67c70365453e00227f61
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=match,pattern=scancode-toolkit/v(\d+\.\d+\.\d+),group=1
- name: Extract tag
run: |
TAG_NAME=${GITHUB_REF##*/}
echo "SCANCODE_TAG=$TAG_NAME" >> "$GITHUB_ENV"
echo "Extracted Tag Name: $TAG_NAME"
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: nexB/scancode-toolkit
ref: refs/tags/${{ env.SCANCODE_TAG }}
- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}