Skip to content

Commit

Permalink
Add release ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mickare committed Apr 16, 2023
1 parent d612b58 commit 473ec44
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 53 deletions.
78 changes: 30 additions & 48 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '43 14 * * 6'
- cron: "43 14 * * 6"

jobs:
analyze:
Expand All @@ -30,53 +30,35 @@ jobs:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.6
- uses: actions/setup-java@v3
with:
java-version: "16"
distribution: "temurin"
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.6

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - uses: actions/setup-java@v3
# with:
# java-version: '16'
# distribution: 'temurin'
# cache: gradle
# - name: Validate Gradle wrapper
# uses: gradle/wrapper-validation-action@v1.0.6
# - name: Build with Gradle
# uses: gradle/gradle-build-action
# with:
# arguments: build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:java"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:java"
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
name: CI
on:
push:
branches: [ main ]
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'temurin'
java-version: "16"
distribution: "temurin"
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.6
- name: Build with Gradle
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: build
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 16
uses: actions/setup-java@v3
with:
java-version: "16"
distribution: "temurin"
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1.0.6
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@v2.4.2
with:
arguments: publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ tasks.test {

publishing {
publications {
register<MavenPublication>("jpc") {
register<MavenPublication>("gpr") {
from(components["java"])
}
}
Expand Down

0 comments on commit 473ec44

Please sign in to comment.