Skip to content

Commit

Permalink
github CI/CD workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
lueck committed Nov 18, 2024
1 parent 3db55c1 commit 59902fc
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+-?**"

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v4

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

- name: Run the Maven verify phase
run: ./mvnw -Drevision=${{ github.ref_name }} -Dchangelist="" -Drelease.url=${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/ --batch-mode --update-snapshots verify

- name: Run XSpec tests
run: target/bin/test.sh

- name: Push packages to the package registry, commit tag is the single source of truth for the release version
run: ./mvnw -Drevision=${{ github.ref_name }} -Dchangelist="" -Drelease.url=${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/ --batch-mode --update-snapshots deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: store oxygen plugin descriptor file
uses: actions/upload-artifact@v4
with:
name: oxygen-plugin-descriptor
path: target/descriptor.xml
retention-days: 1

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
target/*.jar \
target/*.tar.gz \
target/*.zip \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${tag}" \
--generate-notes
pages:
needs: deploy
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
steps:

- name: Download descriptor artifact
uses: actions/download-artifact@v4
with:
name: oxygen-plugin-descriptor

- name: create directory for github pages
run: mkdir -p public

- name: Display structure of downloaded files
run: ls -R

- name: copy descriptor file
run: cp descriptor.xml public/

- name: Deploy descriptor file on Github pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
27 changes: 27 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests
on:
push:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Run the Maven verify phase
run: ./mvnw --batch-mode --update-snapshots verify

- name: Run XSpec tests
run: target/bin/test.sh

0 comments on commit 59902fc

Please sign in to comment.