Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tea -> pkgx for ci/cd #800

Merged
merged 29 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions .github/workflows/build-sign-notarize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,25 @@ on:
s3-electron-dist-key:
description: "The S3 build key includes the installer files: [zip, dmg, etc, yml] from electron"
value: ${{ jobs.build.outputs.s3-artifacts-key }}
s3-custom-notarized-installers-key:
description: "The S3 build key includes the installer files: [zip, dmg, etc, yml] from notarization strategy done outside of electron"
value: ${{ jobs.build.outputs.s3-artifacts-key }}
jobs:
verify:
runs-on: ubuntu-latest
outputs:
is-updated: ${{ steps.check_version.outputs.updated }}
steps:
- uses: teaxyz/setup@v0
with:
version: 0.35.7
- uses: actions/checkout@v3
- uses: pkgxdev/setup@v1
with:
fetch-depth: 5
+: jq
- name: Check if version in package.json was updated
id: check_version
run: |
# Get the current version from package.json
CURRENT_VERSION=$(jq -r .version package.json)

# Get the list of changed files between HEAD and the previous commit
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)

# If package.json is in the list of changed files, check the old version
if echo "$CHANGED_FILES" | grep -q "package.json"; then
OLD_VERSION=$(git show "HEAD^:package.json" | jq -r .version 2>/dev/null)
else
OLD_VERSION=$CURRENT_VERSION
fi
# Fetch the main branch
git fetch origin main:main
OLD_VERSION=$(git show "main:package.json" | jq -r .version 2>/dev/null)

if [[ "$OLD_VERSION" != "$CURRENT_VERSION" ]] && [[ "$CURRENT_VERSION" > "$OLD_VERSION" ]]; then
echo "updated=true" >> $GITHUB_OUTPUT
Expand All @@ -66,13 +55,12 @@ jobs:
if: needs.verify.outputs.is-updated == 'true'
runs-on: macos-latest
outputs:
# just the postfix of the key, not the full key, github does not allow output of secrets
s3-artifacts-key: ${{ steps.s3-artifact-uploader.outputs.key }}
build-version: ${{ steps.gui-version.outputs.version }}
steps:
- uses: teaxyz/setup@v0
with:
version: 0.35.7
- uses: actions/checkout@v3
- uses: pkgxdev/dev@v0

- name: cache node_modules build
# TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read
Expand All @@ -92,7 +80,7 @@ jobs:
./svelte/build

- name: build
run: tea -SE xc dist
run: xc dist
env:
NOTARIZE: true
PUBLIC_MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_PROJECT_TOKEN }}
Expand Down Expand Up @@ -127,7 +115,8 @@ jobs:
id: s3-artifact-uploader
env:
prefix: ${{ inputs.s3-prefix }}
bucket: ${{ secrets.BUILDS_S3_BUCKET }}
run: |
S3_KEY=s3://preview.gui.tea.xyz/$prefix/artifacts.tgz
S3_KEY=$bucket/$prefix/artifacts.tgz
aws s3 cp artifacts.tgz $S3_KEY
echo key=$S3_KEY >> $GITHUB_OUTPUT
echo "key=$prefix/artifacts.tgz" >> $GITHUB_OUTPUT
35 changes: 14 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ jobs:
needs: changes
runs-on: macos-latest
steps:
- uses: teaxyz/setup@v0
with:
version: 0.35.7
- uses: actions/checkout@v3
- uses: pkgxdev/dev@v0
- name: cache node_modules build
uses: actions/cache@v3
with:
Expand All @@ -49,7 +47,7 @@ jobs:
run: |
cp .env.example svelte/.env
- name: install app dependencies
run: tea -E xc setup
run: xc setup
- name: test build electron main process
run: npm run build:main
# TODO: fix
Expand All @@ -67,10 +65,8 @@ jobs:
# see: https://github.com/electron-userland/electron-builder/issues/3179
USE_HARD_LINKS: false
steps:
- uses: teaxyz/setup@v0
with:
version: 0.35.7
- uses: actions/checkout@v3
- uses: pkgxdev/dev@v0
- name: cache node_modules build
uses: actions/cache@v3
with:
Expand All @@ -79,9 +75,9 @@ jobs:
- name: env file
run: cp .env.example svelte/.env
- name: install app dependencies
run: tea -E xc setup
run: xc setup
- name: test build electron main process
run: tea -E xc build
run: xc build
env:
NOTARIZE: "false"
CSC_IDENTITY_AUTO_DISCOVERY: "false"
Expand All @@ -91,16 +87,14 @@ jobs:
mkdir -p /Users/runner/.tea/tea.xyz/gui
touch /Users/runner/.tea/tea.xyz/gui/dev
- name: e2e test
run: tea -E xc e2e
run: xc e2e

build_svelte:
needs: changes
runs-on: macos-latest
steps:
- uses: teaxyz/setup@v0
with:
version: 0.35.7
- uses: actions/checkout@v3
- uses: pkgxdev/dev@v0
- name: cache node_modules build
uses: actions/cache@v3
with:
Expand All @@ -118,8 +112,7 @@ jobs:
- name: get gui version
id: gui-version
run: |
tea +stedolan.github.io/jq
export version=$(echo $(cat package.json) | jq --raw-output .version)
export version=$(echo $(cat package.json) | pkgx jq --raw-output .version)
export postfix=
if GIT_DIR=/path/to/repo/.git git rev-parse $1 >/dev/null 2>&1
then
Expand All @@ -130,7 +123,7 @@ jobs:
echo "version=$version$postfix" >> $GITHUB_OUTPUT

- name: build
run: tea -E xc build:lite
run: xc build:lite
env:
PUBLIC_VERSION: ${{ steps.gui-version.outputs.version }}
BUILD_FOR: preview
Expand Down Expand Up @@ -232,10 +225,10 @@ jobs:
- name: cp package images from prod to preview bucket
env:
prefix: ${{ needs.changes.outputs.preview_folder }}
bucket: ${{ secrets.BUILDS_S3_BUCKET }}
run: |
cd dist && \
aws s3 sync . \
"s3://preview.gui.tea.xyz/$prefix/"
aws s3 sync . "$bucket/$prefix/"

- name: comment install for Linux
if: startsWith(matrix.platform.name, 'linux')
Expand All @@ -245,7 +238,7 @@ jobs:
message: |
**installer for Linux ${{ matrix.platform.name }} is at**:
```bash
http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/${{ needs.changes.outputs.preview_folder }}/${{ steps.build_platform.outputs.filename }}
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.build_platform.outputs.filename }}
```
copy-paste into a browser to download

Expand All @@ -257,7 +250,7 @@ jobs:
message: |
**installers for MacOS darwin+aarch64 is at**:
```bash
http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_arm64 }}
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_arm64 }}
```
copy-paste into a browser to download
- name: comment install for MacOS
Expand All @@ -268,6 +261,6 @@ jobs:
message: |
**installers for MacOS darwin+x86-64 is at**:
```bash
http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_x86 }}
${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/${{ needs.changes.outputs.preview_folder }}/${{ steps.app_files.outputs.dmg_x86 }}
```
copy-paste into a browser to download
4 changes: 0 additions & 4 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ jobs:

- name: remove distribution preview
run: .github/remove-distribution.sh "${{ github.event.number }}-merge"

# consider to rm the folder later, maybe someone might need to download the installer
# - name: remove s3 folder
# run: aws s3 rm s3://preview.gui.tea.xyz/ --recursive --exclude "*" --include "${{ steps.preview.outputs.folder }}/*"
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
secrets: inherit
upload:
needs: [build_desktop]
if: needs.build_desktop.outputs.s3-custom-notarized-installers-key != ''
if: needs.build_desktop.outputs.s3-electron-dist-key != ''
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -37,7 +37,7 @@ jobs:
aws-region: us-east-1
- name: s3 artifact download
env:
S3_INSTALLER_KEY: ${{ needs.build_desktop.outputs.s3-custom-notarized-installers-key }}
S3_INSTALLER_KEY: ${{ secrets.BUILDS_S3_BUCKET }}/${{ needs.build_desktop.outputs.s3-electron-dist-key }}
run: aws s3 cp $S3_INSTALLER_KEY dist.tgz

- run: |
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
env:
arm64: ${{ steps.app_files.outputs.dmg_arm64 }}
x86: ${{ steps.app_files.outputs.dmg_x86 }}
bucket: ${{ secrets.BUILDS_S3_BUCKET }}
run: |
cd dist && \
aws s3 sync . \
"s3://preview.gui.tea.xyz/dev/"
aws s3 sync . "$bucket/dev/"

- uses: actions/setup-node@v3
with:
Expand All @@ -118,7 +118,7 @@ jobs:
PLATFORM: darwin-aarch64
EXT: dmg
VERSION: ${{ steps.get-version.outputs.version }}-dev
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/dev/${{ steps.app_files.outputs.dmg_arm64 }}
DOWNLOAD_URL: ${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/dev/${{ steps.app_files.outputs.dmg_arm64 }}

- name: Slack Notification X86
run: ./.github/notify-slack.js
Expand All @@ -127,7 +127,7 @@ jobs:
PLATFORM: darwin-x86+64
EXT: dmg
VERSION: ${{ steps.get-version.outputs.version }}-dev
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/dev/${{ steps.app_files.outputs.dmg_x86 }}
DOWNLOAD_URL: ${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/dev/${{ steps.app_files.outputs.dmg_x86 }}
- run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_CF_GUI_RELEASE_ID }} \
Expand Down
29 changes: 15 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
aws-region: us-east-1
- name: s3 artifact download
env:
S3_INSTALLER_KEY: ${{ needs.build_desktop.outputs.s3-electron-dist-key }}
S3_INSTALLER_KEY: ${{ secrets.BUILDS_S3_BUCKET }}/${{ needs.build_desktop.outputs.s3-electron-dist-key }}
run: aws s3 cp $S3_INSTALLER_KEY dist.tgz

- run: |
Expand Down Expand Up @@ -97,22 +97,23 @@ jobs:
- name: cp latest as previous release
run: |
aws s3 cp \
s3://dist.tea.xyz/tea.xyz/gui/tea-latest-arm64.dmg \
s3://dist.tea.xyz/tea.xyz/gui/tea-previous-arm64.dmg
$S3_BUCKET/release/ossapp-latest-arm64.dmg \
$S3_BUCKET/release/ossapp-previous-arm64.dmg
aws s3 cp \
s3://dist.tea.xyz/tea.xyz/gui/tea-latest.dmg \
s3://dist.tea.xyz/tea.xyz/gui/tea-previous.dmg
$S3_BUCKET/release/ossapp-latest.dmg \
$S3_BUCKET/release/ossapp-previous.dmg
env:
S3_BUCKET: ${{ secrets.BUILDS_S3_BUCKET }}
- name: publish release
run: |
cd dist && \
aws s3 sync . \
"s3://preview.gui.tea.xyz/release/"
aws s3 cp $ARM_URL s3://dist.tea.xyz/tea.xyz/gui/tea-latest-arm64.dmg
aws s3 cp $X86_URL s3://dist.tea.xyz/tea.xyz/gui/tea-previous-arm64.dmg
aws s3 sync . "$S3_BUCKET/release/"
aws s3 cp $ARM_URL $S3_BUCKET/release/ossapp-latest-arm64.dmg
aws s3 cp $X86_URL $S3_BUCKET/release/ossapp-latest.dmg
env:
ARM_URL: s3://preview.gui.tea.xyz/release/${{ steps.app_files.outputs.dmg_arm64 }}
X86_URL: s3://preview.gui.tea.xyz/release/${{ steps.app_files.outputs.dmg_x86 }}

ARM_URL: ${{ secrets.BUILDS_S3_BUCKET }}/release/${{ steps.app_files.outputs.dmg_arm64 }}
X86_URL: ${{ secrets.BUILDS_S3_BUCKET }}/release/${{ steps.app_files.outputs.dmg_x86 }}
S3_BUCKET: ${{ secrets.BUILDS_S3_BUCKET }}
- run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_GUI_DISTRIBUTION_ID }} \
Expand All @@ -128,7 +129,7 @@ jobs:
PLATFORM: darwin+aarch64
VERSION: ${{steps.tag.outputs.tag}}
EXT: "${{ steps.build_platform.outputs.extension }}"
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/${{ steps.app_files.outputs.dmg_arm64 }}
DOWNLOAD_URL: ${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/release/${{ steps.app_files.outputs.dmg_arm64 }}

- name: Slack Notification X86 Build
run: ./.github/notify-slack.js
Expand All @@ -137,7 +138,7 @@ jobs:
PLATFORM: darwin+x86-64
VERSION: ${{steps.tag.outputs.tag}}
EXT: ${{ steps.build_platform.outputs.extension }}
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/${{ steps.app_files.outputs.dmg_x86 }}
DOWNLOAD_URL: ${{ secrets.BUILDS_S3_PUBLIC_DOMAIN }}/release/${{ steps.app_files.outputs.dmg_x86 }}

- run: |
aws cloudfront create-invalidation \
Expand Down
2 changes: 1 addition & 1 deletion devops/ubuntu/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh -l
tea -SE .
tea -ES xc build
pkgx xc build
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ossapp",
"version": "0.3.0",
"version": "0.3.1",
"private": true,
"description": "The Open Source App Store",
"author": "pkgx inc. <hello@pkgx.dev>",
Expand Down Expand Up @@ -147,5 +147,5 @@
},
"homepage": "https://pkgx.app",
"repository": "https://github.com/pkgxdev/ossapp.git",
"tea": "node^18.16 npm^9.7.2 python^3.11 xc make"
"pkgx": "node^18.16 npm^9.7.2 python@3.11 xc make"
}
Loading