-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adam McKee
committed
Dec 21, 2024
1 parent
67cec70
commit fd10efb
Showing
5 changed files
with
207 additions
and
54 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,50 @@ | ||
name: "Publish: frontend" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release_id: | ||
required: true | ||
type: string | ||
tag_name: | ||
required: true | ||
type: string | ||
upload_hostname: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
|
||
publish-frontend: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: frontend | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag_name }} | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
cache: pnpm | ||
- run: pnpm i | ||
- run: pnpm build | ||
env: | ||
VITE_GITHUB_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }} | ||
- name: upload | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_ID: ${{ inputs.release_id }} | ||
UPLOAD_HOSTNAME: ${{ inputs.upload_hostname }} | ||
run: | | ||
FILENAME=dist.zip | ||
curl --fail --silent -L -X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GH_TOKEN"\ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: $(file dist.zip -b --mime-type)" \ | ||
https://$UPLOAD_HOSTNAME/repos/eighty4/install.sh/releases/$RELEASE_ID/assets?name=frontend.zip \ | ||
--data-binary "@dist.zip" |
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,55 @@ | ||
name: "Publish: lambdas" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
release_id: | ||
required: true | ||
type: string | ||
tag_name: | ||
required: true | ||
type: string | ||
upload_hostname: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
|
||
publish-lambdas: | ||
runs-on: ubuntu-24.04 | ||
defaults: | ||
run: | ||
working-directory: lambdas | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag_name }} | ||
- name: Install l3 | ||
run: | | ||
mkdir -p $HOME/.local/bin | ||
echo "$HOME/.local/bin" >> "$GITHUB_PATH" | ||
RELEASE_URL="https://api.github.com/repos/eighty4/l3/releases/latest" | ||
ASSET_URL=$(curl -s "$RELEASE_URL" | jq -r '.assets[] | select(.name == "l3-linux-x86_64") | .url') | ||
curl -H "Accept: application/octet-stream" -Ls $ASSET_URL > "$HOME/.local/bin/l3" | ||
chmod +x "$HOME/.local/bin/l3" | ||
l3 -h | ||
- name: l3 build | ||
run: l3 build --all --release | ||
- name: zip lambdas.zip | ||
run: zip lambdas.zip l3_build.json *.zip | ||
working-directory: lambdas/.l3/build/release | ||
- name: upload | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
RELEASE_ID: ${{ inputs.release_id }} | ||
UPLOAD_HOSTNAME: ${{ inputs.upload_hostname }} | ||
run: | | ||
FILE=.l3/build/release/lambdas.zip | ||
curl --fail --silent -L -X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GH_TOKEN"\ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: $(file $FILE -b --mime-type)" \ | ||
https://$UPLOAD_HOSTNAME/repos/eighty4/install.sh/releases/$RELEASE_ID/assets?name=lambdas.zip \ | ||
--data-binary "@$FILE" |
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,101 @@ | ||
name: Release | ||
run-name: "Release: ${{ inputs.service }}" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
service: | ||
description: Release service | ||
required: true | ||
type: choice | ||
options: | ||
- frontend | ||
- lambdas | ||
|
||
concurrency: | ||
group: "release-${{ inputs.service }}" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
|
||
# verified: | ||
# uses: ./.github/workflows/verify.yml | ||
|
||
create-git-tag: | ||
runs-on: ubuntu-latest | ||
# needs: [ verified ] | ||
steps: | ||
- if: github.ref != 'refs/heads/main' | ||
run: exit 1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- name: tag | ||
id: tag | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SERVICE: ${{ inputs.service }} | ||
run: | | ||
DATE="$(git show -s --format=%ci $HASH | cut -c1-10)" | ||
HASH="$(git rev-parse --short HEAD)" | ||
VERSION="$DATE.$HASH" | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
git config --global user.name "Adam McKee" | ||
git config --global user.email "[email protected]" | ||
TAG_NAME="$SERVICE-v$VERSION" | ||
git tag $TAG_NAME | ||
git push --atomic origin main $TAG_NAME | ||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
tag_name: ${{ steps.tag.outputs.tag_name }} | ||
version: ${{ steps.tag.outputs.version }} | ||
|
||
create-gh-release: | ||
runs-on: ubuntu-latest | ||
needs: [ create-git-tag ] | ||
steps: | ||
- name: create github release | ||
id: create | ||
env: | ||
TAG_NAME: ${{ needs.create-git-tag.outputs.tag_name }} | ||
VERSION: ${{ needs.create-git-tag.outputs.version }} | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
CREATED_RELEASE=$(gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/eighty4/install.sh/releases \ | ||
-f tag_name="$TAG_NAME" \ | ||
-f name="${{ inputs.service }} $VERSION" \ | ||
-F body="https://github.com/eighty4/install.sh/tree/$TAG_NAME" \ | ||
-F draft=false \ | ||
-F prerelease=false \ | ||
-F generate_release_notes=false) | ||
echo "release_id=$(echo $CREATED_RELEASE | jq '.id')" >> "$GITHUB_OUTPUT" | ||
echo "upload_hostname=$(echo $CREATED_RELEASE | jq '.upload_url' | cut -d'/' -f3)" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
tag_name: ${{ needs.create-git-tag.outputs.tag_name }} | ||
release_id: ${{ steps.create.outputs.release_id }} | ||
upload_hostname: ${{ steps.create.outputs.upload_hostname }} | ||
|
||
publish-frontend: | ||
if: inputs.service == 'frontend' | ||
needs: create-gh-release | ||
uses: ./.github/workflows/publish_frontend.yml | ||
with: | ||
release_id: ${{ needs.create-gh-release.outputs.release_id }} | ||
tag_name: ${{ needs.create-gh-release.outputs.tag_name }} | ||
upload_hostname: ${{ needs.create-gh-release.outputs.upload_hostname }} | ||
secrets: inherit | ||
|
||
publish-lambdas: | ||
if: inputs.service == 'lambdas' | ||
needs: create-gh-release | ||
uses: ./.github/workflows/publish_lambdas.yml | ||
with: | ||
release_id: ${{ needs.create-gh-release.outputs.release_id }} | ||
tag_name: ${{ needs.create-gh-release.outputs.tag_name }} | ||
upload_hostname: ${{ needs.create-gh-release.outputs.upload_hostname }} | ||
secrets: inherit |
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 |
---|---|---|
|
@@ -5,8 +5,7 @@ on: | |
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
concurrency: verify-ci | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
|
This file was deleted.
Oops, something went wrong.