Skip to content

Commit

Permalink
Deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mk868 committed Nov 6, 2024
1 parent 6fb959f commit 34a612d
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 8 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Deploy with Maven

on:
workflow_dispatch:
push:
branches: [ "*" ]

jobs:
# build_test:
# uses: ./.github/workflows/maven.yml
#
# deploy:
# needs: build_test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up JDK 23
# uses: actions/setup-java@v4
# with:
# java-version: '23'
# distribution: 'temurin'
# cache: maven
#
# - uses: s4u/maven-settings-action@v3.1.0
# with:
# servers: |
# [{
# "id": "central",
# "username": "${{ secrets.CENTRAL_USERNAME }}",
# "password": "${{ secrets.CENTRAL_TOKEN }}"
# }]
#
# - name: Cache jextract
# id: cache-jextract
# uses: actions/cache@v4
# with:
# path: jextract
# key: 22-jextract+5-33
#
# - name: Set up jextract
# if: steps.cache-jextract.outputs.cache-hit != 'true'
# run: ./prepare-jextract.sh
#
# - name: Deploy with Maven
# env:
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
# MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_KEY }}
# run: |
# ./prepare.sh
# mvn -B -ntp -f jgpio/pom.xml -P release deploy -DskipTests -Dgpg.signer=bc -Djextract.bin=../jextract/bin/jextract

create_tag:
# needs: deploy
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Set up JDK 23
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'
cache: maven

- name: Get version
id: get_version
run: mvn -f jgpio/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout

- run: |
echo "v${{steps.get_version.outputs.stdout}}"
echo "v${{steps.get_version.outputs}}"
echo "v${{steps.get_version.outputs[0]}}"
echo "v${{join(steps.get_version.outputs.*, '\n')}}"
# - name: Create tag
# uses: actions/github-script@v7
# with:
# script: |
# github.rest.git.createRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: 'refs/tags/v${{steps.get_version.outputs.stdout}}',
# sha: context.sha
# })
15 changes: 8 additions & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Java CI with Maven

on:
push:
branches: [ "main" ]
branches: [ "*" ]
pull_request:
branches: [ "main" ]
workflow_call:

jobs:
build:
Expand Down Expand Up @@ -32,15 +33,15 @@ jobs:

- name: Check sources with Maven
run: |
mvn -B -f jgpio/pom.xml license:check
mvn -B -ntp -f jgpio/pom.xml license:check
# TODO check formatting

- name: Build with Maven
run: |
./prepare.sh
mvn -B -f jgpio/pom.xml install -Djextract.bin=../jextract/bin/jextract
mvn -B -f jgpio-it/pom.xml package
mvn -B -f examples/pom.xml package
mvn -B -ntp -f jgpio/pom.xml install -Djextract.bin=../jextract/bin/jextract
mvn -B -ntp -f jgpio-it/pom.xml package
mvn -B -ntp -f examples/pom.xml package
- uses: actions/upload-artifact@v4
with:
Expand All @@ -67,5 +68,5 @@ jobs:

- name: Test IT
run: |
mvn -B -f jgpio/pom.xml jar:jar install:install
mvn -B -f jgpio-it/pom.xml verify
mvn -B -ntp -f jgpio/pom.xml jar:jar install:install
mvn -B -ntp -f jgpio-it/pom.xml verify
2 changes: 1 addition & 1 deletion .github/workflows/prepare-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: 'Prepare ${{ github.event.inputs.version }}-SNAPSHOT'
title: 'Prepare development ${{ github.event.inputs.version }}-SNAPSHOT'
body: 'Automated preparation of ${{ github.event.inputs.version }}-SNAPSHOT'
commit-message: 'Set version to ${{ github.event.inputs.version }}-SNAPSHOT'
branch: 'snapshot-${{ github.event.inputs.version }}-SNAPSHOT'

0 comments on commit 34a612d

Please sign in to comment.