From 7b2bc070a0a229e118a12ae29ffb3fd37183cb9a Mon Sep 17 00:00:00 2001 From: Kyle Welsby Date: Fri, 28 Jun 2024 11:56:46 +0100 Subject: [PATCH] chore: Update publish workflow to depend on main workflow --- .github/workflows/main.yml | 10 +++++++++- .github/workflows/publish.yml | 14 ++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 077cb0e..e6478bd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,14 @@ name: CI -on: push +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: + - main jobs: lint: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dd87932..0459906 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,12 +1,16 @@ name: Publish Gem on: - push: - tags: - - 'v*' + workflow_run: + workflows: ["CI"] + types: + - completed + branches: + - main jobs: - build: + publish: + if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.ref, 'refs/tags/v') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -18,8 +22,6 @@ jobs: echo 'gem: --no-document' >> ~/.gemrc gem install bundler bundle install - - name: Run tests ๐Ÿงช - run: bundle exec ruby -Ilib test/*.rb - name: Build Gem ๐Ÿ“ฆ run: gem build *.gemspec - name: Publish Gem ๐Ÿš€