Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/dependabot/fetch-m…
Browse files Browse the repository at this point in the history
…etadata-1.6.0
  • Loading branch information
jnewton03 authored Oct 3, 2023
2 parents 7f94c67 + 46cc060 commit 2c8e72c
Show file tree
Hide file tree
Showing 21 changed files with 1,147 additions and 80 deletions.
68 changes: 68 additions & 0 deletions .github/package-deb-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${revision}</version>
<description>Universal pom for deb packaging</description>

<properties>
<maven.antrun.version>3.1.0</maven.antrun.version>
<org.vafer.jdeb.version>1.10</org.vafer.jdeb.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.antrun.version}</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<configuration>
<target>
<untar src="${project.build.directory}/${project.artifactId}-${project.version}.tar.gz" compression="gzip" dest="${project.build.directory}/dist-unpacked" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>${org.vafer.jdeb.version}</version>
<executions>
<execution>
<id>create-deb</id>
<phase>package</phase>
<goals>
<goal>jdeb</goal>
</goals>
</execution>
</executions>
<configuration>
<deb>${project.build.directory}/${project.artifactId}-${project.version}.deb</deb>
<controlDir>${project.basedir}/src/${project.artifactId}/deb/control</controlDir>
<dataSet>
<data>
<src>${project.build.directory}/dist-unpacked</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/usr/bin</prefix>
<filemode>755</filemode>
</mapper>
</data>
</dataSet>
</configuration>
</plugin>
</plugins>
</build>
</project>
54 changes: 54 additions & 0 deletions .github/upload_zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -e

if [[ -z "$GITHUB_TOKEN" ]]; then
echo "Set the GITHUB_TOKEN env variable."
exit 1
fi

if [[ -z "$ASSET_NAME_PREFIX" ]]; then
echo "Set the ASSET_NAME_PREFIX env variable."
exit 1
fi

if [[ -z "$ASSET_DIR" ]]; then
echo "Set the ASSET_DIR env variable."
exit 1
fi

VERSION=$1
if [[ -z "$VERSION" ]]; then
echo "Set the VERSION parameter."
exit 1
fi

_DIR=$(dirname "$0")
UPLOAD_URL=$($_DIR/get_draft_release.sh UPLOAD_URL)

upload_asset() {
local file=$1
local size=$2
local content_type=$3
echo "Uploading $file ($size bytes) to $UPLOAD_URL"
curl \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Length: $size"\
-H "Content-Type: $content_type" \
--data-binary @$file "$UPLOAD_URL?name=$(basename $file)"
}

EXTENSION=".zip"
FILE=$ASSET_DIR/$ASSET_NAME_PREFIX$VERSION$EXTENSION
# Skip if zip files do not exist (some extensions do not generate examples in zip format)
if [[ ! -f "$FILE" && "$FILE" != *".zip" ]]; then
echo "$FILE does not exist."
fi
SIZE=$(wc -c $FILE | awk '{print $1}')
if [[ $SIZE -eq 0 ]]; then
echo "$FILE is empty."
fi
MIME=$(file -b --mime-type $FILE)
upload_asset $FILE $SIZE $MIME


4 changes: 2 additions & 2 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Create Release

on:
workflow_call:

jobs:
sonar:
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.3.4
uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.4.5
secrets: inherit

create-release:
Expand Down
51 changes: 35 additions & 16 deletions .github/workflows/extension-attach-artifact-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Attach Artifact to Release

on:
workflow_call:
inputs:
zip:
description: 'Specify it if you want to attach a zip file to the release'
required: false
default: 'false'
type: string
secrets:
BOT_TOKEN:
description: 'BOT_TOKEN from the caller workflow'
Expand All @@ -14,11 +20,6 @@ on:
required: true

jobs:

release-prepare:
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.3.4
secrets: inherit

attach-to-release:
name: Attach Artifact to Release
if: github.event.pull_request.merged == true
Expand All @@ -36,26 +37,29 @@ jobs:

- name: Get Reusable Script Files
run: |
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.3.4/.github/upload_asset.sh
curl -o $PWD/.github/get_draft_release.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.5/.github/get_draft_release.sh
curl -o $PWD/.github/sign_artifact.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.5/.github/sign_artifact.sh
curl -o $PWD/.github/upload_asset.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.5/.github/upload_asset.sh
chmod +x $PWD/.github/get_draft_release.sh
chmod +x $PWD/.github/sign_artifact.sh
chmod +x $PWD/.github/upload_asset.sh
- name: Update branch with latest commits # needed for getting the latest pom.xml generated by release-prepare step
- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "liquibot@liquibase.org"
- name: Build release artifacts
id: build-release-artifacts
run: |
git pull origin ${{ env.GITHUB_REF_NAME }}
git checkout HEAD~1
mvn -B release:clean release:prepare -Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false
git reset HEAD~ --hard
mvn clean install -DskipTests
- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV

- name: Build release artifacts
id: build-release-artifacts
run: mvn clean install -DskipTests

- name: Get Release Tag
id: get-release-tag
run: echo "release_tag=$(./.github/get_draft_release.sh TAG)" >> $GITHUB_ENV
Expand All @@ -70,7 +74,7 @@ jobs:
tag: ${{ env.release_tag }}
fail-if-no-assets: false
fail-if-no-release: false
assets: "${{ env.artifact_id }}-*"
assets: '*.*'

- name: Import GPG key
id: import_gpg
Expand All @@ -95,3 +99,18 @@ jobs:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
ASSET_NAME_PREFIX: "${{ env.artifact_id }}-"
ASSET_DIR: ./target

- name: Get upload_zip.sh Script File
if: inputs.zip == 'true'
run: |
curl -o $PWD/.github/upload_zip.sh https://raw.githubusercontent.com/liquibase/build-logic/v0.4.5/.github/upload_zip.sh
chmod +x $PWD/.github/upload_zip.sh
- name: Attach Zip File to Draft Release
if: inputs.zip == 'true'
id: upload-release-zip
run: ./.github/upload_zip.sh $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
ASSET_NAME_PREFIX: "${{ env.artifact_id }}-"
ASSET_DIR: ./target
26 changes: 0 additions & 26 deletions .github/workflows/extension-release-perform.yml

This file was deleted.

21 changes: 19 additions & 2 deletions .github/workflows/extension-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Prepare release
on:
workflow_call:

permissions:
contents: write
pull-requests: write

jobs:
prepare-release:
name: Prepare release
Expand All @@ -12,13 +16,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main

- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
overwrite-settings: false

- name: Configure Git
run: |
Expand All @@ -27,7 +34,11 @@ jobs:
- name: Prepare Maven Release
run: |
mvn -B release:clean release:prepare -Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }}
mvn -B build-helper:parse-version versions:set release:clean release:prepare \
-Dusername=liquibot -Dpassword=$GITHUB_TOKEN \
-Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" \
-DdevelopmentVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion} \
-DcheckModificationExcludeList=pom.xml
- name: Save Release files
uses: actions/upload-artifact@v3
Expand All @@ -36,3 +47,9 @@ jobs:
path: |
**/pom.xml.*
**/release.properties
release-rollback:
needs: prepare-release
if: ${{ always() && contains(needs.*.result, 'failure') }}
uses: liquibase/build-logic/.github/workflows/extension-release-rollback.yml@v0.4.5
secrets: inherit
40 changes: 28 additions & 12 deletions .github/workflows/extension-release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV

- name: Download Release Artifacts
uses: robinraju/release-downloader@v1.6
with:
tag: "${{ github.event.release.tag_name }}"
filename: "${{ env.artifact_id }}-*"
out-file-path: "."

- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
Expand All @@ -37,6 +26,28 @@ jobs:
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Configure Git
run: |
git config user.name "liquibot"
git config user.email "liquibot@liquibase.org"
- name: Build release artifacts
id: build-release-artifacts
run: |
mvn -B release:clean release:prepare -Dusername=liquibot -Dpassword=$GITHUB_TOKEN -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" -DreleaseVersion=${{ github.event.inputs.liquibaseVersion }} -DpushChanges=false
git reset HEAD~ --hard
- name: Get Artifact ID
id: get-artifact-id
run: echo "artifact_id=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV

- name: Download Release Artifacts
uses: robinraju/release-downloader@v1.8
with:
tag: "${{ github.event.release.tag_name }}"
filename: "${{ env.artifact_id }}-*"
out-file-path: "."

- name: Publish to Maven Central
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand All @@ -53,4 +64,9 @@ jobs:
-Djavadoc=${{ env.artifact_id }}-${version}-javadoc.jar \
-Dfiles=${{ env.artifact_id }}-${version}.jar.asc,${{ env.artifact_id }}-${version}-sources.jar.asc,${{ env.artifact_id }}-${version}-javadoc.jar.asc,${{ env.artifact_id }}-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,
-Dclassifiers=,sources,javadoc,
maven-release:
needs: release
uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.4.5
secrets: inherit
Loading

0 comments on commit 2c8e72c

Please sign in to comment.