-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
126 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Deploy Junior | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: deploy-group | ||
|
||
jobs: | ||
build-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get version | ||
id: version | ||
run: | | ||
version=$(git describe --tags --abbrev=0) | ||
next_version=$(($version + 1)) | ||
echo "version=$next_version" >> $GITHUB_OUTPUT | ||
- name: Collect Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/twohoursonelife/junior | ||
tags: | | ||
type=raw,value=${{ steps.version.outputs.version }} | ||
type=sha | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} | ||
|
||
# TODO: Reconsider building this into the image itself since restructure | ||
- name: Add version.txt | ||
run: echo ${{ steps.version.outputs.version }} > version.txt | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . # Intentionally using Path context to include version.txt | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }}, ghcr.io/twohoursonelife/junior:latest | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
generateReleaseNotes: true | ||
makeLatest: true | ||
tag: ${{ steps.version.outputs.version }} | ||
|
||
deploy-commands: | ||
runs-on: ubuntu-latest | ||
environment: prod-commands | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Deploy commands | ||
run: node deploy-commands.js | ||
env: | ||
PROD_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }} | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-release | ||
environment: prod | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Deploy commands | ||
- uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Deploy commands | ||
run: bun run deploy-commands.js | ||
env: | ||
PROD_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
|
||
# Deploy to Fly | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
version="1" | ||
next_version=$(($version + 1)) | ||
echo $next_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters