-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Steep leaves for 7 years, add
deno
, stir, enjoy
- Loading branch information
Showing
40 changed files
with
3,172 additions
and
0 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,150 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- README.md | ||
|
||
concurrency: | ||
group: distribute | ||
cancel-in-progress: true | ||
|
||
env: | ||
VERBOSE: 1 | ||
TEA_SECRET: ${{ secrets.TEA_SECRET }} | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.extract.outputs.version }} | ||
commence: ${{ steps.rev-parse.outputs.result == 'commence' }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: teaxyz/setup@v0 | ||
|
||
#TMP until we go public | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.PK }} | ||
|
||
- id: extract | ||
name: determine current version | ||
run: | | ||
source <(tea -Eds) | ||
echo "::set-output name=version::$VERSION" | ||
if test x$VERSION = x; then exit 1; fi | ||
env: | ||
VERBOSE: 0 | ||
|
||
- id: rev-parse | ||
name: did we already publish this version? | ||
run: | | ||
if git show-ref --tags v${{ steps.extract.outputs.version }} --quiet; then | ||
echo "::set-output name=result::cancel" | ||
else | ||
echo "::set-output name=result::commence" | ||
fi | ||
- uses: andymckay/[email protected] | ||
if: ${{ steps.rev-parse.outputs.result == 'cancel' }} | ||
|
||
ci: | ||
needs: [check] | ||
uses: ./.github/workflows/ci.yml | ||
secrets: inherit | ||
|
||
cd: | ||
needs: [check, ci] | ||
runs-on: ubuntu-latest | ||
env: | ||
VERSION: ${{ needs.check.outputs.version }} | ||
FILENAME: /opt/tea-${{ needs.check.outputs.version }}+${{ matrix.build-id }}.tar.gz | ||
strategy: | ||
matrix: | ||
include: | ||
- deno-target: x86_64-apple-darwin | ||
build-id: darwin+x86-64 | ||
tea-prefix: darwin/x86-64 | ||
- deno-target: aarch64-apple-darwin | ||
build-id: darwin+aarch64 | ||
tea-prefix: darwin/aarch64 | ||
- deno-target: x86_64-unknown-linux-gnu | ||
tea-prefix: linux/x86-64 | ||
build-id: linux+x86-64 | ||
steps: | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x #FIXME | ||
|
||
- uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Compile | ||
run: | | ||
deno compile \ | ||
--allow-read --allow-write=/opt --allow-net --allow-run --allow-env \ | ||
--import-map=./import-map.json \ | ||
--output ./tea.out \ | ||
--target ${{ matrix.deno-target }} \ | ||
./src/app.ts | ||
- run: | | ||
sudo mkdir -p /opt/tea.xyz/v$VERSION/bin | ||
mv tea.out /opt/tea.xyz/v$VERSION/bin/tea | ||
cd /opt | ||
tar czf $FILENAME tea.xyz | ||
# TODO v'*' should be a (non permanent) redirect | ||
|
||
- run: | | ||
aws s3 cp \ | ||
$FILENAME \ | ||
s3://${{ secrets.AWS_S3 }}/tea.xyz/${{ matrix.tea-prefix }}/v$VERSION.tar.gz \ | ||
--metadata-directive REPLACE \ | ||
--cache-control max-age=31536000,immutable | ||
aws s3 cp \ | ||
$FILENAME \ | ||
s3://${{ secrets.AWS_S3 }}/tea.xyz/${{ matrix.tea-prefix }}/v'*'.tar.gz \ | ||
--metadata-directive REPLACE \ | ||
--cache-control no-cache,must-revalidate | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: tarballs | ||
path: ${{ env.FILENAME }} | ||
if-no-files-found: error | ||
|
||
release: | ||
permissions: | ||
contents: write | ||
needs: [cd, check] | ||
runs-on: ubuntu-latest | ||
env: | ||
TAG: v${{ needs.check.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: tarballs | ||
path: artifacts | ||
|
||
#TODO find a release action that will tag atomically | ||
# the GitHub API does this so it is frankly unacceptable the action refuses | ||
- run: | | ||
git tag ${{ env.TAG }} | ||
git push origin ${{ env.TAG }} | ||
- uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.TAG }} | ||
files: artifacts/*.tar.gz | ||
fail_on_unmatched_files: true |
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,37 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- tsconfig.json | ||
- '**/*.ts' | ||
- import-map.json | ||
- .github/workflows/ci.yml | ||
workflow_call: | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- macos-latest | ||
- ubuntu-latest | ||
env: | ||
VERBOSE: 1 | ||
TEA_SECRET: ${{ secrets.TEA_SECRET }} | ||
steps: | ||
#TMP until we go public | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.PK }} | ||
|
||
- uses: actions/checkout@v3 | ||
- uses: teaxyz/setup@v0 | ||
- run: ./scripts/test.sh | ||
env: | ||
GITHUB_TOKEN: ${{ github.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
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,7 @@ | ||
{ | ||
"deno.enable": true, | ||
"deno.lint": true, | ||
"deno.unstable": true, | ||
"deno.importMap": "./import-map.json", | ||
"deno.config": "./tsconfig.json" | ||
} |
Oops, something went wrong.