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 d9d608f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release preview
on: [pull_request]
jobs:
run-semantic-release-github-pr:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 }}
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 d9d608f

Please sign in to comment.