Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #97 from tiki/release/1.0
Browse files Browse the repository at this point in the history
Release/1.0
  • Loading branch information
mike-audi authored Apr 1, 2023
2 parents 090181d + b1cc395 commit 2b100b9
Show file tree
Hide file tree
Showing 29 changed files with 195 additions and 15,322 deletions.
7 changes: 0 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/worker/upload/"
schedule:
interval: "weekly"
commit-message:
prefix: "npm"

- package-ecosystem: "maven"
directory: "/"
schedule:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ jobs:
with:
fetch-depth: 1

- name: Set up JDK 19
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '19'
java-version: '20'
distribution: 'zulu'

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
language: 'java'

- name: Autobuild
uses: github/codeql-action/autobuild@v2
Expand Down
123 changes: 21 additions & 102 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,75 +7,16 @@ on:
types:
- closed

permissions:
contents: write
id-token: write

# Cancel any active builds when new commits are pushed
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
bump_and_tag:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
environment: Production
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: tester
POSTGRES_PASSWORD: pgtestpw
POSTGRES_DB: l0_storage
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'zulu'

- name: Install CLI
uses: dopplerhq/cli-action@v2

- name: Install PostgreSQL client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: Create Tables
run: psql -h localhost -d l0_storage -U tester -f database/create_tables.sql
env:
PGPASSWORD: pgtestpw

- name: Maven Package
run: doppler run -c tst -- mvn clean package
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_ST }}

- name: Bump Version
id: bump-version
uses: RichardInnocent/[email protected]
with:
access-token: ${{ secrets.github_token }}
version-prefix:

- name: Set Worker Version
id: package_version
uses: KageKirin/set-node-package-version@v1
with:
file: 'worker/upload/package.json'
version: ${{ steps.bump-version.outputs.new-version }}
outputs:
version: ${{ steps.bump-version.outputs.new-version }}
test_and_push:
runs-on: ubuntu-latest
needs: bump_and_tag
Expand All @@ -100,10 +41,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 19
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '19'
java-version: '20'
distribution: 'zulu'

- name: Install CLI
Expand Down Expand Up @@ -132,20 +73,28 @@ jobs:
- name: Registry login
run: doctl registry login --expiry-seconds 600

- name: Mvn project version
id: version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: |
registry.digitalocean.com/tiki/l0-storage:${{ needs.bump_and_tag.outputs.version }}
registry.digitalocean.com/tiki/l0-storage:${{ steps.version.outputs.version }}
registry.digitalocean.com/tiki/l0-storage:latest
build-args: |
JAR_FILE=target/*.jar
outputs:
version: ${{ steps.version.outputs.version }}

deploy_to_infra:
runs-on: ubuntu-latest
needs: [ bump_and_tag, test_and_push ]
needs: [ test_and_push ]
environment: Production
steps:
- name: Checkout
Expand Down Expand Up @@ -177,38 +126,7 @@ jobs:
id: apply
run: terraform apply -auto-approve
working-directory: infra
deploy_worker:
runs-on: ubuntu-latest
needs: deploy_to_infra
environment: Production
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Run CI
run: |
cd worker/upload/
npm ci

- name: Wrangler
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: 'worker/upload'
secrets: |
REMOTE_ID
REMOTE_SECRET
WASABI_ID
WASABI_SECRET
env:
REMOTE_ID: ${{ secrets.WORKER_ENV_REMOTE_ID }}
REMOTE_SECRET: ${{ secrets.WORKER_ENV_REMOTE_SECRET }}
WASABI_ID: ${{ secrets.WORKER_ENV_WASABI_ID }}
WASABI_SECRET: ${{ secrets.WORKER_ENV_WASABI_SECRET }}
sentry_release:
runs-on: ubuntu-latest
needs: deploy_to_infra
Expand All @@ -227,9 +145,10 @@ jobs:
environment: public
ignore_missing: true
ignore_empty: true

publish_docs:
runs-on: ubuntu-latest
needs: [ sentry_release, bump_and_tag ]
needs: [ sentry_release, test_and_push ]
environment: Production
steps:
- name: Checkout
Expand All @@ -238,9 +157,9 @@ jobs:
- name: OpenApi
uses: readmeio/[email protected]
with:
rdme: openapi docs/openapi.yaml --key=${{ secrets.README_API_KEY }} --id=6379efc05c98fc002512b213
rdme: openapi openapi.yaml --key=${{ secrets.README_API_KEY }} --id=6379efc05c98fc002512b213

- name: Release
uses: softprops/action-gh-release@v1
uses: ncipollo/release-action@v1
with:
tag_name: ${{ needs.bump_and_tag.outputs.version }}
tag: ${{ needs.test_and_push.outputs.version }}
34 changes: 3 additions & 31 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 19
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '19'
java-version: '20'
distribution: 'zulu'

- name: Install CLI
Expand All @@ -63,32 +63,4 @@ jobs:
with:
name: Java Report
path: "target/surefire-reports/**/*.xml"
reporter: java-junit

JEST:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Run CI
run: |
cd worker/upload/
npm ci
- name: Run Tests
run: |
cd worker/upload/
npm run test
- name: Publish Results
uses: dorny/test-reporter@v1
if: always()
with:
name: JS Report
path: "worker/**/reports/*.xml"
reporter: jest-junit
reporter: java-junit
100 changes: 100 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Version

on:
pull_request:
branches:
- main

# Cancel any active builds when new commits are pushed
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
Version:
if: startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14.5
env:
POSTGRES_USER: tester
POSTGRES_PASSWORD: pgtestpw
POSTGRES_DB: l0_storage
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '20'
distribution: 'zulu'

- name: Checkout PR
id: getpr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
export PR_BRANCH=$(git branch --show-current)
echo "branch=$PR_BRANCH" >> $GITHUB_OUTPUT
- name: Get Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: ${{ steps.getpr.outputs.branch }}

- name: Set Version
run: |
sed -i '0,/<version>*.*.*<\/version>/s//<version>${{ steps.semver.outputs.nextStrict }}<\/version>/' pom.xml
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '20'
distribution: 'zulu'

- name: Install CLI
uses: dopplerhq/cli-action@v2

- name: Install PostgreSQL client
run: |
sudo apt-get update
sudo apt-get install --yes postgresql-client
- name: Create Tables
run: psql -h localhost -d l0_storage -U tester -f database/create_tables.sql
env:
PGPASSWORD: pgtestpw

- name: OAS3
run: doppler run -c tst -- mvn clean verify
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_ST }}

- name: Commit Changes
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "GH Action"
git add pom.xml
git add openapi.yaml
git commit -m 'version bump'
git push
outputs:
version: ${{ steps.semver.outputs.nextStrict }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM azul/zulu-openjdk:19 as base
FROM azul/zulu-openjdk:20 as base

FROM base as development
RUN apt update -y
Expand Down
Loading

0 comments on commit 2b100b9

Please sign in to comment.