Switch to github cr

This commit is contained in:
Sebastien Clement 2021-02-18 15:21:59 +01:00
parent b8a12a061f
commit e36bd805ea
2 changed files with 25 additions and 9 deletions

View File

@ -16,14 +16,18 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up JDK 1.8 - name: Set up JDK 1.8
uses: actions/setup-java@v1 uses: actions/setup-java@v1
with: with:
java-version: 1.8 java-version: 1.8
- name: Grant execute permission for gradlew - name: Grant execute permission for gradlew
run: chmod +x gradlew run: chmod +x gradlew
- name: Build with Gradle - name: Build with Gradle
run: ./gradlew build run: ./gradlew build
- name: Upload Jar File - name: Upload Jar File
uses: actions/upload-artifact@v2-preview uses: actions/upload-artifact@v2-preview
with: with:
@ -31,11 +35,12 @@ jobs:
path: build/libs/ path: build/libs/
build-docker: build-docker:
runs-on: [ubuntu-latest] runs-on: [ ubuntu-latest ]
needs: [build-gradle] needs: [ build-gradle ]
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Download artifact - name: Download artifact
uses: actions/download-artifact@v1.0.0 uses: actions/download-artifact@v1.0.0
with: with:
@ -43,11 +48,21 @@ jobs:
name: claptrap_jar name: claptrap_jar
# Destination path # Destination path
path: build/libs/ path: build/libs/
- name: Publish Docker
uses: elgohr/Publish-Docker-Github-Action@master - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v1
with: with:
name: brokenfire/brokendiscordbot registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.CR_PAT }}
tags: latest,${{ env.GITHUB_RUN_ID}}
buildargs: GITHUB_RUN_NUMBER=${{env.RELEASE_VERSION}} - name: Build and push Docker
uses: docker/build-push-action@v2
with:
push: true
context: .
tags: ghcr.io/sebclem/claptrapbot:latest, ghcr.io/sebclem/claptrapbot:${{ env.GITHUB_RUN_ID}}
file: ./Dockerfile

View File

@ -9,3 +9,4 @@ RUN java -version
ENV PORT=8080 ENV PORT=8080
ENV TOKEN=10 ENV TOKEN=10
CMD java -jar bot.jar -t ${TOKEN} CMD java -jar bot.jar -t ${TOKEN}
LABEL org.opencontainers.image.source=https://github.com/Sebclem/ClaptrapBot/