-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (89 loc) · 3.14 KB
/
publish-and-release.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
#
# Copyright (c) 2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/mp-spdz-integration.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Publish and release
on:
workflow_run:
workflows: ["Artifacts"]
branches:
- master
types:
- completed
workflow_dispatch:
jobs:
prepare:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-20.04
outputs:
VERSION: "${{ steps.maven-project.outputs.version }}-${{ github.run_id }}-${{ github.run_number }}-${{ steps.short-sha.outputs.sha }}"
steps:
- name: Parse short sha
uses: benjlevesque/short-sha@v1.2
id: short-sha
- uses: actions/checkout@v2
- name: Get Maven project version
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
id: maven-project
draft-release:
runs-on: ubuntu-20.04
needs: [prepare]
env:
VERSION: "${{ needs.prepare.outputs.VERSION }}"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Retrieve license obligation resources
run: |
cd 3RD-PARTY-LICENSES
find . -maxdepth 1 -type d -not -path . | zip -r@ ${GITHUB_REPOSITORY#*/}-3rd-party-copyrights
find . -iname origin.src | \
awk '{ \
split($0,b,"/"); \
system("xargs < " $0 " curl --create-dirs -Lo ./sources/" b[2] ".zip " $2)}' && \
find -regex './sources$' | awk '{system("zip -jr ./${GITHUB_REPOSITORY#*/}-3rd-party-sources.zip " $0)}'
mkdir -p ../license-obligations && mv `find . -regex "^./${GITHUB_REPOSITORY#*/}-3rd-party-.*.zip$"` ../license-obligations/
cd -
- name: Generate change log
run: |
chmod +x .github/scripts/generate-changelog.sh
./.github/scripts/generate-changelog.sh
- name: Create release tag
run: |
git tag ${{ env.VERSION }}
git push --tags
- name: Create draft
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
draft: true
bodyFile: /tmp/cs.repository-changelog.${{ env.VERSION }}
artifacts: "license-obligations/*"
publish:
runs-on: ubuntu-20.04
needs: [prepare,draft-release]
env:
VERSION: "${{ needs.prepare.outputs.VERSION }}"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
- name: Update Maven project version
run: mvn versions:set -DnewVersion=${{ env.VERSION }} -DprocessAllModules -DgenerateBackupPoms=false
- name: Publish version to GitHub Packages
run: mvn deploy -Dskip.tests --batch-mode --no-transfer-progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
allowUpdates: true
draft: false
omitBodyDuringUpdate: true