Skip to content

Commit

Permalink
ci: migrate from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
pmowrer committed Jan 12, 2024
1 parent 1a68933 commit b02c051
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release preview
on: [pull_request]
jobs:
release-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
# semantic-release dry-run workaround https://github.com/semantic-release/semantic-release/issues/1890#issuecomment-974512960
- run: git checkout -b ${{ github.head_ref }}
- run: unset GITHUB_ACTIONS && yarn && node ./bin/semantic-release-github-pr --debug --branches ${{ github.head_ref }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release

on:
pull_request:
branches:
- master
types:
- closed

jobs:
release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npx semantic-release --debug
11 changes: 11 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Tests
on: [pull_request]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn && yarn test
6 changes: 1 addition & 5 deletions bin/semantic-release-github-pr.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/usr/bin/env node
const execa = require('execa');
const envCi = require('env-ci');
const { argv } = process;
const { resolve } = require('path');
const { getCurrentBranchName } = require('../src/git-utils');

(async function() {
const plugins = `${resolve(__dirname, '../src/index.js')}`;
const currentBranchName = await getCurrentBranchName();
// If we're in a "detached HEAD" state, assume we're running on CI.
const branch =
currentBranchName !== 'HEAD' ? currentBranchName : envCi().prBranch;
const branch = await getCurrentBranchName();

const args = argv.slice(2).concat([
// We want to run on pull request builds, but `semantic-release` won't
Expand Down

0 comments on commit b02c051

Please sign in to comment.