Skip to content

Commit

Permalink
feat: run unit tests and generate proper releases
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosdevpereira committed Oct 8, 2022
1 parent ae23643 commit 336938c
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 37 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/publish.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
branches:
- main

name: Release
jobs:
release-please:
runs-on: ubuntu-latest
environment:
name: production
url: https://github.com/marketplace/actions/test-publish-to-cloudflare
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GH_TOKEN }}
release-type: node
package-name: test-publish-to-cloudflare
default-branch: main
pull-request-title-pattern: "🚀 Release ${component} ${version}"
changelog-types: '[{"type":"feat","section":"✨ Features","hidden":false},{"type":"fix","section":"🚨 Bug Fixes","hidden":false},{"type":"hotfix","section":"🚒 Hotfixes","hidden":false},{"type":"chore","section":"👷 Maintenance","hidden":false},{"type":"docs","section":"📚 Documentation","hidden":false}]'
- uses: actions/checkout@v3
- name: tag major and minor versions
if: ${{ steps.release.outputs.release_created }}
run: |
git config user.name carlosdevpereira
git config user.email carlos@carlosdevpereira.com
pnpm install && pnpm build
git add dist/** -f
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
git push origin :v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git tag -a v${{ steps.release.outputs.major }} -m "Release v${{ steps.release.outputs.major }}"
git tag -a v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} -m "Release v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}"
git push origin v${{ steps.release.outputs.major }}
git push origin v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}
41 changes: 41 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on:
push:
branches:
- "**"

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16]

steps:
- uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 7

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install dependencies 📦
run: pnpm install

- name: Test & Publish to Cloudflare 🧪
uses: carlosdevpereira/test-publish-to-cloudflare@v1
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
branchName: ${{ github.ref_name }}
cloudflareProjectName: test-publish-to-cloudflare
cloudflareApiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflareAccountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
baseCloudflareDeploymentUrl: test-publish-to-cloudflare.pages.dev

0 comments on commit 336938c

Please sign in to comment.