Files
archived-web-api/.github/workflows/release.yml
Tyler Wilding f4dfb6045a API Rewrite and Dockerization (#78)
* workers: init

* workers: d1 initial work

* workers: resuming work, simplified schema

* api: flesh out the majority of critical features

* api: get rid of the old implementation

* db: seed database with current releases

* db: break seed files up, too much for a single stdout buffer

* api: support version diff'ing

* d1: debugging insert issue

* api: fix insert issue (missing `await`s) and explicitly cache to avoid invocations

* api: append CORS headers for requests originating from `pcsx2.net`

* api: update seed data and fix response data

* api: optimize DB indexes and add caching

* api: update page rule cache when a release is added/deleted/modified

* api: most functionality ported over to rocket.rs

* api: finish off core implementation

* api: dockerize

* api: cleaning up TODOs

* v1: remove some of the old implementation

* v2: small script to pull release data, update DB seed

* v2: minor cleanup

* v2: finalize v1 -> v2 transition

* v2: synchronize db on startup

* sqlx: commit sql query metadata

* v2: handful of bug fixes and v1 parity adjustments

* v2: some repo house cleaning

* ci: add CI workflows

* ci: finalize ci implementation
2025-02-26 20:31:03 -05:00

95 lines
2.6 KiB
YAML

name: 🏭 Draft Release
on:
workflow_dispatch:
inputs:
bump:
description: 'Semver Bump Type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: write
jobs:
cut_release:
name: Cut Release
runs-on: ubuntu-latest
outputs:
new_tag: ${{ steps.set_tag.outputs.new_tag }}
steps:
# Docs - https://github.com/mathieudutour/github-tag-action
- name: Bump Version and Push Tag
if: github.repository == 'PCSX2/web-api'
id: tag_version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: v
default_bump: ${{ github.event.inputs.bump }}
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.tag_version.outputs.new_tag }} --generate-notes --draft --repo ${{ github.repository }}
- name: Output new tag
id: set_tag
run: |
echo "new_tag=${{ steps.tag_version.outputs.new_tag }}" >> $GITHUB_OUTPUT
build_image:
if: github.repository == 'PCSX2/web-api'
needs:
- cut_release
name: "Build and Publish Image"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.cut_release.outputs.new_tag }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- name: Publish Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_VAL=${{ needs.cut_release.outputs.new_tag }}
gh release edit ${TAG_VAL} --draft=false --repo open-goal/jak-project