Skip to content

Commit

Permalink
Merge pull request #7 from GiganticMinecraft/ci
Browse files Browse the repository at this point in the history
Add CI and CD
  • Loading branch information
Lucky authored Dec 23, 2023
2 parents e6ab460 + c13d44c commit f49e3f9
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/ci-and-cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI and CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: jar
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: jar
path: ./build/libs/*.jar
output-sha:
name: 最終コミットのSHA値を取得する
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
outputs:
sha: ${{ steps.output-sha.outputs.sha }}
steps:
- uses: actions/checkout@v4
- name: Outputs the value
id: output-sha
run: |
VALUE=$(git log --format='%h' -n 1)
echo "sha=$VALUE" >> $GITHUB_OUTPUT
shell: bash
cd:
runs-on: ubuntu-latest
needs:
- ci
- output-sha
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create and push a tag
id: tag-name
run: |
TAG_NAME=sha-${{ needs.output-sha.outputs.sha }}
git tag $TAG_NAME
git push origin $TAG_NAME
echo "value=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: jar
- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./ByeByeWither*.jar
tag_name: ${{ steps.tag-name.outputs.value }}
draft: false
prerelease: true
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit f49e3f9

Please sign in to comment.