Merge pull request #31 from Flux159/pr31 #8
Workflow file for this run
This file contains hidden or 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
name: cd | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Run Tests | |
run: bun run test | |
env: | |
ANTHROPIC_API_KEY: "test" | |
- name: Update version number | |
uses: reecetech/[email protected] | |
id: version | |
with: | |
scheme: semver | |
increment: patch | |
- name: Configure Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Commit the new version | |
run: | | |
# Make sure we're on main branch | |
git checkout main | |
# Update the version in package.json and commit the change | |
jq --arg v "${{ steps.version.outputs.current-version }}" '.version = $v' package.json > temp.json && mv temp.json package.json | |
git add package.json | |
git commit -m "Bump version to ${{ steps.version.outputs.current-version }}" | |
# Create and push the tag | |
git tag ${{ steps.version.outputs.current-version }} | |
# Push both the commit and the tag | |
git push origin main | |
git push origin ${{ steps.version.outputs.current-version }} | |
- name: Build For production | |
run: bun run build | |
- name: Publish to NPM | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc | |
echo "//registry.npmjs.org/:always-auth=true" >> ~/.npmrc | |
npm publish | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: flux159/${{ github.event.repository.name }}:latest,flux159/${{ github.event.repository.name }}:${{ steps.version.outputs.current-version }} |