Skip to content

Commit

Permalink
Merge pull request #122 from CMIPT/workflow-release
Browse files Browse the repository at this point in the history
Release workflow
  • Loading branch information
Kaiser-Yang authored Feb 27, 2025
2 parents 021a09d + d84228d commit fbc8af6
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GCS_SPRING_MAPPING_PORT=8080
# Make sure GCS_SSH_MAPPING_PORT and GCS_SPRING_MAPPING_PORT could be
# accessed by others
POSTGRES_MAPPING_PATH=/var/gcs/postgres
TARGET_JAR_PATH=./target/gcs-0.1.0-SNAPSHOT.jar
TARGET_JAR_PATH=./target/gcs-back-end.jar

# NOTE:
# In most situations, you do not need to update those
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:
push:
tags:
- "v*.*.*"

jobs:
build:
name: Build as a tar.gz
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Setup jdk17 and maven
uses: s4u/[email protected]
with:
java-version: 17
checkout-submodules: true

- name: Build jar package
run: mvn clean package -Dmaven.test.skip=true

- name: Get latest tar from gcs-front-end
run: curl -L https://github.com/CMIPT/gcs-front-end/releases/latest/download/gcs-front-end.tar.gz -o gcs-front-end.tar.gz

- name: Extract gcs-front-end
run: tar -xzf gcs-front-end.tar.gz

- name: Tar as a gcs.tar.gz
run: tar -czf gcs.tar.gz target/gcs-back-end.jar .env Dockerfile docker-compose.yml 3rdparty/gitolite .output database/init

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: gcs
path: gcs.tar.gz

release:
name: Release to GitHub
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: gcs

- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
token: ${{ github.token }}
files: gcs.tar.gz
draft: false
prerelease: false
generate_release_notes: true
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>edu.cmipt</groupId>
<artifactId>gcs</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.0</version>
<name>gcs</name>
<description>The back end of git center server</description>
<url/>
Expand Down Expand Up @@ -145,6 +145,7 @@
</dependencies>

<build>
<finalName>gcs-back-end</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down

0 comments on commit fbc8af6

Please sign in to comment.