This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
47 lines (47 loc) · 1.86 KB
/
ci-master.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
name: ci-master
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: sigstore/cosign-installer@main
- uses: actions/checkout@v2
- name: environment
run: |
export VERSION=$(git rev-parse --short ${GITHUB_SHA})
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: docker build
run: |
docker build \
--tag docker.pkg.github.com/${GITHUB_REPOSITORY}/cwa-log-upload:latest \
--tag docker.pkg.github.com/${GITHUB_REPOSITORY}/cwa-log-upload:${VERSION} \
--tag ${MTR_REPOSITORY}/cwa-log-upload:${VERSION} \
--build-arg MAVEN_PASSWORD=${APP_PACKAGES_PASSWORD} \
--build-arg MAVEN_USERNAME=${APP_PACKAGES_USERNAME} \
.
env:
APP_PACKAGES_USERNAME: ${{ github.actor }}
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
MTR_REPOSITORY: ${{ secrets.MTR_REPOSITORY }}
- name: docker push github
run: |
echo ${GITHUB_TOKEN} | docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY_OWNER} --password-stdin
docker push docker.pkg.github.com/${GITHUB_REPOSITORY}/cwa-log-upload:latest
docker push docker.pkg.github.com/${GITHUB_REPOSITORY}/cwa-log-upload:${VERSION}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: docker push mtr
run: |
echo ${MTR_TOKEN} | docker login ${MTR_REPOSITORY} -u ${MTR_USER} --password-stdin
docker push ${MTR_REPOSITORY}/cwa-log-upload:${VERSION}
cosign sign --key env://MTR_PRIVATE_KEY ${MTR_REPOSITORY}/cwa-log-upload:${VERSION}
env:
MTR_REPOSITORY: ${{ secrets.MTR_REPOSITORY }}
MTR_USER: ${{ secrets.MTR_USER }}
MTR_TOKEN: ${{ secrets.MTR_TOKEN }}
MTR_PRIVATE_KEY: ${{ secrets.MTR_PRIVATE_KEY }}
COSIGN_PASSWORD: ${{ secrets.MTR_PRIVATE_KEY_PASSWORD }}