63 lines
2.9 KiB
YAML
63 lines
2.9 KiB
YAML
name: Gitea Runner E2E Publish
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [runner/gitea-e2e]
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: [ubuntu-latest, bytelyst, hostinger]
|
|
container:
|
|
image: node:20-bookworm
|
|
options: -v /home/gitea-runner/.gitea_publish_npmrc:/run/secrets/gitea_publish_npmrc:ro
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
github-server-url: https://gitea.bytelyst.com
|
|
- name: Install pnpm
|
|
run: |
|
|
npm install -g pnpm@9.12.0
|
|
pnpm --version
|
|
- name: Set test version
|
|
working-directory: packages/_runner-e2e-test
|
|
run: |
|
|
VERSION="0.0.1-e2e.${GITHUB_RUN_ID:-$(date +%s)}"
|
|
echo "TEST_VERSION=$VERSION" >> "$GITHUB_ENV"
|
|
npm version "$VERSION" --no-git-tag-version --allow-same-version
|
|
node -p "require('./package.json').version"
|
|
- name: Configure registry .npmrc
|
|
working-directory: packages/_runner-e2e-test
|
|
run: |
|
|
cp /run/secrets/gitea_publish_npmrc .npmrc
|
|
sed -E 's|(:_auth=).*|\1***|; s|(:_authToken=).*|\1***|' .npmrc
|
|
- name: Publish to Hostinger Gitea
|
|
working-directory: packages/_runner-e2e-test
|
|
run: pnpm publish --no-git-checks --registry https://gitea.bytelyst.com/api/packages/bytelyst/npm/
|
|
- name: Verify package returned by Gitea
|
|
working-directory: packages/_runner-e2e-test
|
|
run: |
|
|
npm view "@bytelyst/runner-e2e-test@$TEST_VERSION" version --registry https://gitea.bytelyst.com/api/packages/bytelyst/npm/ | grep -qx "$TEST_VERSION"
|
|
echo "PASS: version in Gitea"
|
|
- name: Verify pnpm install and require works
|
|
run: |
|
|
mkdir -p /tmp/runner-e2e-consumer && cd /tmp/runner-e2e-consumer
|
|
cp /run/secrets/gitea_publish_npmrc .npmrc
|
|
cat > package.json <<JSON
|
|
{ "name": "consumer", "version": "1.0.0", "dependencies": { "@bytelyst/runner-e2e-test": "$TEST_VERSION" } }
|
|
JSON
|
|
pnpm install --no-frozen-lockfile
|
|
node -e "const m=require('@bytelyst/runner-e2e-test'); console.log(m); process.exit(m.ok?0:1);"
|
|
echo "PASS: install + require works"
|
|
- name: Verify local pack matches Gitea stored tarball shasum
|
|
working-directory: packages/_runner-e2e-test
|
|
run: |
|
|
pnpm pack --pack-destination /tmp
|
|
TARBALL=$(ls /tmp/bytelyst-runner-e2e-test-*.tgz)
|
|
LOCAL_SHA=$(sha1sum "$TARBALL" | awk '{print $1}')
|
|
GITEA_SHA=$(npm view "@bytelyst/runner-e2e-test@$TEST_VERSION" dist.shasum --registry https://gitea.bytelyst.com/api/packages/bytelyst/npm/)
|
|
echo "LOCAL_SHA=$LOCAL_SHA"
|
|
echo "GITEA_SHA=$GITEA_SHA"
|
|
[ "$LOCAL_SHA" = "$GITEA_SHA" ] || { echo "FAIL: pnpm pack tarball does not match Gitea stored tarball"; exit 1; }
|
|
echo "PASS: byte-identical tarball stored in Hostinger Gitea"
|