Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release action #35

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build plugin
description: Builds the plugin
inputs:
java_version:
required: true
description: Java version for building the plugin
runs:
using: "composite"
steps:
- name: 'Set up JDK ${{ inputs.java_version }}'
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ inputs.java_version }}
- name: Test
shell: bash
run: |
./mvnw --color=always -B verify
- uses: actions/upload-artifact@v3
name: Attach generated update site as zip
if: runner.os == 'Linux'
with:
name: mat-calcite-plugin-update-site
# actions/upload-artifact always creates .zip, so we specify directory here to prevent double zip archiving
path: MatCalciteRepository/target/repository/*
# Default retention is 90 days, and we publish the archives to the update site anyway
retention-days: 4
12 changes: 12 additions & 0 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Caches Maven dependencies
description: Caches Maven dependencies
runs:
using: "composite"
steps:
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
30 changes: 6 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,14 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache local Maven repository
uses: actions/cache@v3
- name: Cache dependencies
uses: ./.github/actions/cache
- name: Build
uses: ./.github/actions/build
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: 'Set up JDK ${{ matrix.java }}'
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ matrix.java }}
- name: Test
run: |
./mvnw --color=always -B verify
- uses: actions/upload-artifact@v3
name: Attach generated update site as zip
if: matrix.os == 'ubuntu-latest'
with:
name: mat-calcite-plugin-update-site
# actions/upload-artifact always creates .zip, so we specify directory here to prevent double zip archiving
path: MatCalciteRepository/target/repository/*
# Default retention is 90 days, and we publish the archives to the update site anyway
retention-days: 4
java_version: ${{ matrix.java }}
- name: Publish Eclipse update site
if: matrix.os == 'ubuntu-latest' && github.repository == 'vlsi/mat-calcite-plugin' && github.ref == 'refs/heads/main'
if: runner.os == 'Linux' && github.repository == 'vlsi/mat-calcite-plugin' && github.ref == 'refs/heads/main'
uses: ./.github/actions/publish-update-site
with:
update_site_token:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version'
required: true
next_version:
description: 'Next version to set after release (without -SNAPSHOT)'
required: true

jobs:
release-job:
permissions:
# For creating releases
contents: write
env:
RELEASE_VERSION: ${{ inputs.release_version }}
NEXT_VERSION: ${{ inputs.next_version }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache dependencies
uses: ./.github/actions/cache
- name: Update version to stable
shell: bash
run: |
./mvnw tycho-versions:set-version -DnewVersion=$RELEASE_VERSION
git add -u
git commit -m "Prepare for release v$RELEASE_VERSION"
git tag v$RELEASE_VERSION
- name: Build
uses: ./.github/actions/build
with:
java_version: ${{ matrix.java }}
- name: Publish release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: v${{ inputs.next_version }}
generate_release_notes: true
draft: true
files: |
MatCalciteRepository/target/MatCalciteRepository*.zip
- name: Publish Eclipse update site
if: github.repository == 'vlsi/mat-calcite-plugin'
uses: ./.github/actions/publish-update-site
with:
update_site_token:
${{ secrets.UPDATE_SITE_TOKEN }}
- name: Prepare for next development iteration
shell: bash
run: |
./mvnw tycho-versions:set-version -DnewVersion=$NEXT_VERSION-SNAPSHOT
git add -u
git commit -m "Update version to $NEXT_VERSION-SNAPSHOT"
git push origin main v$RELEASE_VERSION


32 changes: 0 additions & 32 deletions release.sh

This file was deleted.

Loading