From 7293a7ff55af3b057d202daa48116ed264475809 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Thu, 5 Nov 2020 05:14:58 -0800 Subject: [PATCH] Move public build infra entirely to GitHub Summary: As part of our release confidence effort, this replaces the flaky internal task that creates the tag, promotes it to a release and uploads the artifacts to it. Instead, we do all this in one lengthy GitHub Action. There seems to be some duplication here but this is because of the unfortunate restriction GitHub Actions imposes to avoid recursive Actions. I.e. we cannot create a tag/release and have another, independent Action pick up from there to do the building and releasing. The `passy/` references were necessary because existing Actions didn't quite what we wanted to: - `tag-version-commit` expected the title of the commit to match the precise tag to create. However, we want to use a regex to *extract* from the "Flipper Release: vA.B.C". My fork allows specifying a grouping regex for that. - `github-upload-release-artifacts-action` relied on being triggered by a tag. As described above, that's not possible with this setup. Instead, this takes an existing tag and attaches to it. Reviewed By: nikoant Differential Revision: D24627518 fbshipit-source-id: 8121df6aa7bd36bda28e0d3cb207a002cd127647 --- .github/workflows/release.yml | 137 ++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..cdc5f6dbc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,137 @@ +name: Release +on: + push: + branches: + - master + paths: + - 'desktop/package.json' + +jobs: + release: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag-version-commit.outputs.tag }} + steps: + - uses: actions/checkout@v2 + - name: Tag version commit + id: tag-version-commit + uses: passy/tag-version-commit@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + version_tag_prefix: 'v' + version_assertion_command: 'grep -q "\"version\": \"$version\"" desktop/package.json' + - name: Create release + if: ${{ steps.tag-version-commit.outputs.tag != '' }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag-version-commit.outputs.tag }} + release_name: ${{ steps.tag-version-commit.outputs.tag }} + body: | + See https://github.com/facebook/flipper/blob/master/desktop/static/CHANGELOG.md + for full notes. + draft: false + prerelease: false + + build-mac: + runs-on: macos-latest + env: + desktop-directory: ./desktop + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Install + run: yarn + working-directory: ${{env.desktop-directory}} + - name: Build + run: yarn build --mac --mac-dmg + working-directory: ${{env.desktop-directory}} + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: 'Flipper-mac.dmg' + path: 'dist/Flipper-mac.dmg' + + build-linux: + runs-on: ubuntu-latest + env: + desktop-directory: ./desktop + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Install + run: yarn + working-directory: ${{env.desktop-directory}} + - name: Build + run: yarn build --linux + working-directory: ${{env.desktop-directory}} + - name: Upload Linux + uses: actions/upload-artifact@v1 + with: + name: 'Flipper-linux.zip' + path: 'dist/Flipper-linux.zip' + + build-win: + runs-on: windows-latest + env: + desktop-directory: ./desktop + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + - name: Install + run: yarn + working-directory: ${{env.desktop-directory}} + - name: Build + run: yarn build --win + working-directory: ${{env.desktop-directory}} + - name: Upload Windows + uses: actions/upload-artifact@v1 + with: + name: 'Flipper-win.zip' + path: 'dist/Flipper-win.zip' + + publish: + runs-on: ubuntu-latest + needs: + - build-win + - build-linux + - build-mac + - release + + steps: + - name: Download Mac + if: ${{ needs.release.outputs.tag != '' }} + uses: actions/download-artifact@v1 + with: + name: 'Flipper-mac.dmg' + path: 'Flipper-mac.dmg' + - name: Download Linux + if: ${{ needs.release.outputs.tag != '' }} + uses: actions/download-artifact@v1 + with: + name: 'Flipper-linux.zip' + path: 'Flipper-linux.zip' + - name: Download Windows + if: ${{ needs.release.outputs.tag != '' }} + uses: actions/download-artifact@v1 + with: + name: 'Flipper-win.zip' + path: 'Flipper-win.zip' + - name: GitHub Upload Release Artifacts + if: ${{ needs.release.outputs.tag != '' }} + uses: passy/github-upload-release-artifacts-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + created_tag: ${{ needs.release.outputs.tag }} + args: Flipper-mac.dmg Flipper-linux.zip Flipper-win.zip