Select release commit from larger push (#1678)

Summary:
GitHub only issues one push event for multiple commits.
This causes things to behave weirdly. My action now
looks for a commit with a certain message and runs
the subsequent steps on it. If there's more than one
matching commit, it uses the last one. Not great, not terrible.

Pull Request resolved: https://github.com/facebook/flipper/pull/1678

Test Plan: Ran it on my fork: https://github.com/passy/flipper-1/actions/runs/360332680

Reviewed By: nikoant

Differential Revision: D24955986

Pulled By: passy

fbshipit-source-id: 6dcbe11e69bf77c803e3907ced3185ca85483ec8
This commit is contained in:
Pascal Hartig
2020-11-16 11:04:03 -08:00
committed by Facebook GitHub Bot
parent 484a555428
commit 30d212da65

View File

@@ -12,12 +12,21 @@ jobs:
outputs: outputs:
tag: ${{ steps.tag-version-commit.outputs.tag }} tag: ${{ steps.tag-version-commit.outputs.tag }}
steps: steps:
- uses: passy/extract-version-commit@main
id: extract-version-commit
with:
version_regex: '^Flipper Release: v([0-9]+\.[0-9]+\.[0-9]+)(?:\n|$)'
- uses: actions/checkout@v2 - uses: actions/checkout@v2
if: ${{ steps.extract-version-commit.outputs.commit != ''}}
with:
ref: ${{ steps.extract-version-commit.outputs.commit }}
- name: Tag version commit - name: Tag version commit
if: ${{ steps.extract-version-commit.outputs.commit != ''}}
id: tag-version-commit id: tag-version-commit
uses: passy/tag-version-commit@v1.1.1 uses: passy/tag-version-commit@master
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ steps.extract-version-commit.outputs.commit }}
version_tag_prefix: 'v' version_tag_prefix: 'v'
version_assertion_command: 'grep -q "\"version\": \"$version\"" desktop/package.json' version_assertion_command: 'grep -q "\"version\": \"$version\"" desktop/package.json'
- name: Create release - name: Create release
@@ -35,12 +44,16 @@ jobs:
prerelease: false prerelease: false
build-mac: build-mac:
needs:
- release
runs-on: macos-latest runs-on: macos-latest
env: env:
desktop-directory: ./desktop desktop-directory: ./desktop
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.tag }}
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '12.x' node-version: '12.x'
@@ -63,12 +76,16 @@ jobs:
path: 'dist/Flipper-mac.dmg' path: 'dist/Flipper-mac.dmg'
build-linux: build-linux:
needs:
- release
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
desktop-directory: ./desktop desktop-directory: ./desktop
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.tag }}
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '12.x' node-version: '12.x'
@@ -91,12 +108,16 @@ jobs:
path: 'dist/Flipper-linux.zip' path: 'dist/Flipper-linux.zip'
build-win: build-win:
needs:
- release
runs-on: windows-latest runs-on: windows-latest
env: env:
desktop-directory: ./desktop desktop-directory: ./desktop
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
ref: ${{ needs.release.outputs.tag }}
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '12.x' node-version: '12.x'
@@ -119,12 +140,12 @@ jobs:
path: 'dist/Flipper-win.zip' path: 'dist/Flipper-win.zip'
publish: publish:
runs-on: ubuntu-latest
needs: needs:
- build-win - build-win
- build-linux - build-linux
- build-mac - build-mac
- release - release
runs-on: ubuntu-latest
steps: steps:
- name: Download Mac - name: Download Mac
@@ -166,3 +187,4 @@ jobs:
with: with:
workflow: Publish Pods workflow: Publish Pods
token: ${{ secrets.PERSONAL_TOKEN }} token: ${{ secrets.PERSONAL_TOKEN }}
ref: ${{ needs.release.outputs.tag }}