Compare commits
1
Commits
dfa5380986
...
v1.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a785719788 |
No files matched your search
@@ -0,0 +1,87 @@
|
|||||||
|
# On every push to master, publish a Gitea release for the pom.xml version if one
|
||||||
|
# does not exist yet. "Version changed" == "no release tagged v<version> yet", which
|
||||||
|
# also covers multi-commit pushes, force pushes and re-runs after a failed upload.
|
||||||
|
#
|
||||||
|
# Assets: target/sopa-<v>.zip (self-contained distribution) and
|
||||||
|
# target/sopa-<v>-shaded.jar (fat jar). The plain jar is not uploaded.
|
||||||
|
name: release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: release
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAVEN_VERSION: 3.9.11
|
||||||
|
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
|
||||||
|
# The automatic token can create releases on current Gitea; set a RELEASE_TOKEN
|
||||||
|
# secret (PAT with write:repository) if yours refuses it.
|
||||||
|
TOKEN: ${{ secrets.RELEASE_TOKEN || github.token }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: '21'
|
||||||
|
cache: maven
|
||||||
|
|
||||||
|
- name: Install Maven
|
||||||
|
run: |
|
||||||
|
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" \
|
||||||
|
| tar -xz -C "$RUNNER_TEMP"
|
||||||
|
echo "$RUNNER_TEMP/apache-maven-${MAVEN_VERSION}/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Check whether this version is already released
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(mvn -B -q help:evaluate -Dexpression=project.version -DforceStdout)
|
||||||
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
STATUS=$(curl -s -o /dev/null -w '%{http_code}' \
|
||||||
|
-H "Authorization: token $TOKEN" "$API/releases/tags/v$VERSION")
|
||||||
|
case "$STATUS" in
|
||||||
|
404) echo "release=true" >> "$GITHUB_OUTPUT"; echo "v$VERSION is new, releasing." ;;
|
||||||
|
200) echo "release=false" >> "$GITHUB_OUTPUT"; echo "v$VERSION already released, skipping." ;;
|
||||||
|
*) echo "Unexpected HTTP $STATUS from release lookup"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# The Liberica JDKs (~700 MB) the pom downloads for jlink.
|
||||||
|
- name: Cache distribution JDKs
|
||||||
|
if: steps.version.outputs.release == 'true'
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .jdks
|
||||||
|
key: jdks-${{ hashFiles('pom.xml') }}
|
||||||
|
restore-keys: jdks-
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
if: steps.version.outputs.release == 'true'
|
||||||
|
run: mvn -B package
|
||||||
|
|
||||||
|
- name: Create release and upload assets
|
||||||
|
if: steps.version.outputs.release == 'true'
|
||||||
|
env:
|
||||||
|
VERSION: ${{ steps.version.outputs.version }}
|
||||||
|
run: |
|
||||||
|
ZIP="target/sopa-$VERSION.zip"
|
||||||
|
JAR="target/sopa-$VERSION-shaded.jar"
|
||||||
|
test -f "$ZIP" && test -f "$JAR"
|
||||||
|
|
||||||
|
BODY=$(jq -n --arg tag "v$VERSION" --arg sha "$GITHUB_SHA" \
|
||||||
|
'{tag_name: $tag, target_commitish: $sha, name: $tag, draft: false, prerelease: false}')
|
||||||
|
ID=$(curl -fsS -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||||
|
-d "$BODY" "$API/releases" | jq -r .id)
|
||||||
|
echo "Created release $ID"
|
||||||
|
|
||||||
|
for f in "$ZIP" "$JAR"; do
|
||||||
|
curl -fsS -X POST -H "Authorization: token $TOKEN" \
|
||||||
|
-F "attachment=@$f" "$API/releases/$ID/assets?name=$(basename "$f")" > /dev/null
|
||||||
|
echo "Uploaded $(basename "$f")"
|
||||||
|
done
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# You can override the included template(s) by including variable overrides
|
|
||||||
# SAST customization: https://docs.gitlab.com/user/application_security/sast/#available-cicd-variables
|
|
||||||
# Secret Detection customization: https://docs.gitlab.com/user/application_security/secret_detection/pipeline/configure/
|
|
||||||
# Dependency Scanning customization: https://docs.gitlab.com/user/application_security/dependency_scanning/dependency_scanning_sbom/#customizing-analyzer-behavior
|
|
||||||
# Container Scanning customization: https://docs.gitlab.com/user/application_security/container_scanning/#customizing-analyzer-behavior
|
|
||||||
# Note that environment variables can be set in several places
|
|
||||||
# See https://docs.gitlab.com/ci/variables/#cicd-variable-precedence
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
sast:
|
|
||||||
stage: test
|
|
||||||
include:
|
|
||||||
- template: Security/SAST.gitlab-ci.yml
|
|
||||||
Reference in new issue
Block a user