Skip to content

test: add upload integration tests #2

test: add upload integration tests

test: add upload integration tests #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
jobs:
# ─── Step 1: Validate before publishing anything ────────────────────────────
test:
name: Syntax & dependency check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Syntax check
run: |
node --check server/server.js
node --check server/config.js
node --check server/db.js
node --check server/cleanup.js
node --check bin/instbyte.js
# ─── Step 2a: Publish to npm ─────────────────────────────────────────────────
publish-npm:
name: Publish to npm
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js with npm registry
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: npm
- name: Install production dependencies
run: npm ci --omit=dev
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ─── Step 2b: Build and push Docker image (multi-platform) ──────────────────
publish-docker:
name: Publish to Docker Hub
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU (for ARM emulation)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version tag
id: meta
run: echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
mohitgauniyal/instbyte:latest
mohitgauniyal/instbyte:${{ steps.meta.outputs.tag }}
# ─── Step 3: Create GitHub Release with auto-generated notes ────────────────
create-release:
name: Create GitHub Release
needs: [publish-npm, publish-docker]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true