-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish on GitHub Releases Publish to GitHub Packages
- Loading branch information
Showing
19 changed files
with
231 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,16 @@ | ||
# Java Gradle CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-java/ for more details | ||
# | ||
--- | ||
version: 2.1 | ||
|
||
orbs: | ||
gradle: circleci/gradle@1.0.10 | ||
|
||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/openjdk:8-jdk | ||
|
||
working_directory: ~/repo | ||
|
||
environment: | ||
TERM: dumb | ||
|
||
machine: true | ||
steps: | ||
- checkout | ||
|
||
- run: | ||
command: sudo apt update | ||
- run: | ||
name: Install OS dependencies | ||
command: sudo apt install ttf-liberation | ||
|
||
- run: git --no-pager diff --check `git log --oneline | tail -1 | cut --fields=1 --delimiter=' '` | ||
|
||
- run: circleci/test-eof-newline | ||
|
||
- gradle/with_cache: | ||
steps: | ||
- run: | ||
name: Build | ||
command: ./gradlew build | ||
|
||
- store_artifacts: | ||
path: examples/build/reports | ||
destination: reports/examples | ||
- store_artifacts: | ||
path: core/build/reports | ||
destination: reports/core | ||
- store_artifacts: | ||
path: examples/build/resources/test/examples | ||
destination: examples | ||
- run: | ||
name: Collect test results | ||
command: | | ||
mkdir -p /tmp/test_results/junit | ||
find . -name '*TEST-*.xml' -exec cp -v {} /tmp/test_results/junit/ \; | ||
when: always | ||
- store_test_results: | ||
path: /tmp/test_results | ||
|
||
- run: | ||
name: Don't publish for PRs from forks | ||
command: '[ -n "$AES_IV" ] && true || circleci step halt' | ||
|
||
- run: | ||
name: Decrypt secrets | ||
command: | | ||
set -e | ||
mkdir -p $HOME/.gradle/ | ||
openssl aes-256-cbc -K $AES_KEY -iv $AES_IV -in circleci/gradle.properties.enc -out ~/.gradle/gradle.properties -d | ||
openssl aes-256-cbc -K $AES_KEY -iv $AES_IV -in circleci/signing.gpg.enc -d | gpg --import || true | ||
openssl aes-256-cbc -K $AES_KEY -iv $AES_IV -in circleci/signing.gpg.enc -d > ~/.gnupg/secring.gpg | ||
openssl aes-256-cbc -K $AES_KEY -iv $AES_IV -in circleci/dockercfg.enc -out ~/.dockercfg -d | ||
- setup_remote_docker | ||
|
||
- run: | ||
name: publish | ||
command: circleci/publish.sh | ||
- run: echo Disabled | ||
workflows: | ||
version: 2 | ||
push: | ||
jobs: &jobs | ||
- build | ||
|
||
tag_push: | ||
workflow: | ||
jobs: | ||
- build: | ||
filters: | ||
tags: | ||
only: /^release\/\d+\.\d+\.\d+/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
nightly: | ||
triggers: | ||
- schedule: | ||
cron: 0 0 * * * | ||
filters: | ||
branches: | ||
only: /master|3\.\d+/ | ||
jobs: *jobs | ||
only: | ||
- none |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
*.jks binary | ||
*.enc binary | ||
*.icc binary | ||
*.gpg binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
name: CI | ||
env: | ||
SUMMON_PROVIDER: /usr/local/bin/gopass | ||
steps: | ||
- run: echo ${{ github.ref }} | ||
|
||
- uses: actions/checkout@v1 | ||
|
||
- name: Get tag | ||
id: tag2 | ||
uses: frabert/replace-string-action@v1.1 | ||
with: | ||
pattern: 'refs/tags/(.*)' | ||
string: '{{ github.ref }}' | ||
replace-with: '$1' | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- run: echo --${{ steps.tag2.outputs.replaced }}-- | ||
|
||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8.0.232 | ||
- run: java -version | ||
|
||
- run: sudo apt update | ||
- name: Install OS dependencies | ||
run: sudo apt install fonts-liberation | ||
|
||
- run: git --no-pager diff --check `git log --oneline | tail -1 | cut --fields=1 --delimiter=' '` | ||
- run: ci/test-eof-newline | ||
|
||
- uses: camptocamp/initialise-gopass-summon-action@v1 | ||
with: | ||
large-secret-passphrase: ${{secrets.LARGE_SECRET_PASSPHRASE}} | ||
github-gopass-ci-token: ${{secrets.GITHUB_GOPASS_CI_TOKEN}} | ||
- run: gpg --export-secret-keys --armor D121AF2DFA8E140688BD968930C9B913FD42EF13 > CI.asc | ||
|
||
- run: ./gradlew build | ||
|
||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: Reports examples | ||
path: examples/build/reports | ||
if: always() | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: Reports core | ||
path: core/build/reports | ||
if: always() | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: Examples | ||
path: examples/build/resources/test/examples | ||
if: always() | ||
|
||
- name: Collect test results | ||
run: | | ||
mkdir -p /tmp/test_results/junit | ||
find . -name '*TEST-*.xml' -exec cp -v {} /tmp/test_results/junit/ \; | ||
if: failure() | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: Test results | ||
path: /tmp/test_results | ||
if: failure() | ||
|
||
- run: mkdir -p ~/.docker | ||
- name: Decrypt secrets | ||
run: summon --environment dockerhub bash -c 'envsubst < ci/docker-config.json.tmpl > ~/.docker/config.json' | ||
|
||
- name: publish | ||
run: ci/publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: ./gradlew :core:libSourcesJar | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- run: ./gradlew :core:libJavadocJar | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- id: version | ||
run: echo "##[set-output name=version;]$(grep version build.gradle|sed "s/ \+version = .\(.*\)./\1/g")" | ||
- id: tag | ||
run: echo "##[set-output name=tag;]$(echo github.ref|sed 's%refs/tags/%%g')" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ steps.tag.outputs.tag }} | ||
draft: false | ||
prerelease: false | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./core/build/libs/print-servlet-${{ steps.version.outputs.version }}.war | ||
asset_name: print-servlet-${{ steps.version.outputs.version }}.war | ||
asset_content_type: application/java-archive | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./core/build/distributions/core-${{ steps.version.outputs.version }}.zip | ||
asset_name: print-cli-${{ steps.version.outputs.version }}.zip | ||
asset_content_type: application/zip | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./core/build/libs/print-lib-${{ steps.version.outputs.version }}.jar | ||
asset_name: print-lib-${{ steps.version.outputs.version }}.jar | ||
asset_content_type: application/java-archive | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./core/build/libs/print-lib-${{ steps.version.outputs.version }}-sources.jar | ||
asset_name: print-lib-${{ steps.version.outputs.version }}-sources.jar | ||
asset_content_type: application/java-archive | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1.0.1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./core/build/libs/print-lib-${{ steps.version.outputs.version }}-javadoc.jar | ||
asset_name: print-lib-${{ steps.version.outputs.version }}-javadoc.jar | ||
asset_content_type: application/java-archive | ||
if: "startsWith(github.ref, 'refs/tags/')" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"auths": { | ||
"https://index.docker.io/v1/": { | ||
"auth": "${TOKEN}" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import re | ||
import subprocess | ||
|
||
|
||
def publish(docker_version): | ||
print("Deploying image to docker hub for tag " + docker_version) | ||
subprocess.check_call(["./gradlew", "--console=plain", "createDocker"]) | ||
image_name = "camptocamp/mapfish_print:" + docker_version | ||
subprocess.check_call(["docker", "tag", "camptocamp/mapfish_print:latest", image_name]) | ||
subprocess.check_call(["docker", "push", image_name]) | ||
|
||
|
||
def main(): | ||
if os.environ.get("GITHUB_EVENT_NAME") == "pull_request": | ||
print("Not deploying image for pull requests") | ||
exit(0) | ||
|
||
branch_match = re.match("^refs/heads/(.*)$", os.environ["GITHUB_REF"]) | ||
tag_match = re.match("^refs/tags/(.*)$", os.environ["GITHUB_REF"]) | ||
if branch_match and branch_match.group(1) == "master": | ||
publish("latest") | ||
|
||
elif tag_match: | ||
release_match = re.match("^release/(.*)$", tag_match.group(1)) | ||
publish(release_match.group(1) if release_match else tag_match.group(1)) | ||
if release_match: | ||
print("Publishing") | ||
subprocess.check_call(["./gradlew", "publish"]) | ||
|
||
elif branch_match: | ||
publish(branch_match.group(1)) | ||
|
||
else: | ||
print("Not deploying image") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.