Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dashaun committed Feb 3, 2024
1 parent e146db7 commit fd715a6
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
## Adjust as needed with your values

export BW_SESSION=$(bw unlock --raw)
export TWITCH_CLIENT_ID=$(bw get username twitch-exporter)
export TWITCH_CLIENT_SECRET=$(bw get password twitch-exporter)
export TWITCH_CHANNEL_NAME=javagrunt
export TWITCH_CLIENT_REDIRECT_URL=http://localhost:8080
export TWITCH_ACCESS_TOKEN=$(bw get password twitch-exporter-token)
export TWITCH_ACCESS_TOKEN=$(bw get password twitch-access-token)
72 changes: 72 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: multi-arch-builder

on:
push:
tags:
- "v*"

env:
IMAGE_NAME: dashaun/com.javagrunt.service.twitch

jobs:
build-mac:
runs-on: macos-14
steps:
#Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: dashaun
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install JDK
uses: sfesenko/setup-sdkman@v1
with:
deps: java:23.1.2.r21-nik
- name: Checkout Main
uses: actions/checkout@v3
with:
submodules: true
#Build Image
- name: Build Image
run: ./mvnw -Pnative spring-boot:build-image
#Deploy the image to the Docker registry
- name: Push Images to Docker Registry
run: docker push -a $IMAGE_NAME
build-ubuntu:
runs-on: ubuntu-latest
steps:
#Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: dashaun
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Install JDK
uses: sfesenko/setup-sdkman@v1
with:
deps: java:23.1.2.r21-nik
- name: Checkout Main
uses: actions/checkout@v3
with:
submodules: true
#Build Image
- name: Build Image
run: ./mvnw -Pnative spring-boot:build-image
#Deploy the image to the Docker registry
- name: Push Images to Docker Registry
run: docker push -a $IMAGE_NAME
manifest:
needs: [build-ubuntu,build-mac]
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: dashaun
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: create-manifest
run: |
docker manifest create $IMAGE_NAME:$GITHUB_REF_NAME --amend $IMAGE_NAME:$GITHUB_REF_NAME-x86_64 --amend $IMAGE_NAME:$GITHUB_REF_NAME-aarch_64
docker manifest push $IMAGE_NAME:$GITHUB_REF_NAME
docker manifest create $IMAGE_NAME:latest --amend $IMAGE_NAME:$GITHUB_REF_NAME-x86_64 --amend $IMAGE_NAME:$GITHUB_REF_NAME-aarch_64
docker manifest push $IMAGE_NAME:latest
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=21.0.1-graalce
java=23.1.2.r21-nik
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Instructions on how to install and set up the project.

```bash
git clone https://github.com/javagrunt/com.javagrunt.service.twitch
git clone https://github.com/javagrunt-com/com.javagrunt.service.twitch
cd com.javagrunt.service.twitch
```

Expand All @@ -17,6 +17,12 @@ cd com.javagrunt.service.twitch
./mvnw spring-boot:test-run
```

## Getting a Twitch `User` access token

```bash
twitch token -u -s "user:read:email moderation:read channel:read:subscriptions"
```

## See Also

- [Blog](https://dashaun.com/posts/bootiful-twitch-metrics-for-prometheus/)
Expand Down
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
<version>3.2.2</version>
<relativePath></relativePath>
</parent>
<groupId>com.javagrunt.service.twitch</groupId>
Expand All @@ -19,14 +19,14 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.5</version>
<version>1.3.12</version>
</dependency>
<dependency>
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j</artifactId>
<version>1.18.0</version>
</dependency>
<dependency>
<dependency>
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j-helix</artifactId>
<version>1.18.0</version>
Expand Down Expand Up @@ -83,6 +83,21 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
<configuration>
<image>
<builder>dashaun/builder:tiny</builder>
<createdDate>now</createdDate>
<name>dashaun/${project.name}:v${project.version}-${os.detected.arch}</name>
</image>
</configuration>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit fd715a6

Please sign in to comment.