From 78cdde62af9285df9e7dad3979f1ec54beba8c72 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 31 Mar 2024 16:28:49 -0300 Subject: [PATCH] duplicate workflow to test new approach in isolation --- .github/workflows/ci-linux.yml | 226 +++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 .github/workflows/ci-linux.yml diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml new file mode 100644 index 00000000000..27ee199b172 --- /dev/null +++ b/.github/workflows/ci-linux.yml @@ -0,0 +1,226 @@ +name: CI + +on: + push: + branches: + - development + - linux + - linux-vnext + - 'linux-release-*' + tags: + - 'release-*.*.*-linux*' + - 'release-*.*.*-test*' + pull_request: + branches: + - linux + - linux-vnext + - 'linux-release-*' + +env: + NODE_VERSION: 18.16.1 + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + env: + RELEASE_CHANNEL: ${{ inputs.environment }} + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository || github.repository }} + ref: ${{ inputs.ref }} + submodules: recursive + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + - run: yarn + - run: yarn validate-electron-version + - run: yarn lint + - run: yarn validate-changelog + - name: Ensure a clean working directory + run: git diff --name-status --exit-code + arm64: + name: Ubuntu (arm64) + runs-on: ubuntu-latest + permissions: + contents: write + timeout-minutes: 60 + env: + npm_config_arch: arm64 + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository || github.repository }} + ref: ${{ inputs.ref }} + submodules: recursive + - uses: actions/setup-python@v5 + if: matrix.friendlyName != 'Ubuntu' + with: + python-version: '3.11' + - name: Use Node.js ${{ env.NODE_VERSION }} + if: matrix.friendlyName != 'Ubuntu' + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + - name: Get app version + id: version + run: echo version=$(jq -r ".version" app/package.json) >> $GITHUB_OUTPUT + - name: Package and test application in container + uses: shiftkey/desktop-ubuntu-amd64-packaging + - name: Upload output artifacts + uses: actions/upload-artifact@v4 + with: + name: Ubuntu-arm64-artifacts + path: | + dist/*.AppImage + dist/*.deb + dist/*.rpm + dist/*.sha256 + retention-days: 5 + arm: + name: Ubuntu (arm) + runs-on: ubuntu-latest + permissions: + contents: write + timeout-minutes: 60 + env: + npm_config_arch: arm + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository || github.repository }} + ref: ${{ inputs.ref }} + submodules: recursive + - uses: actions/setup-python@v5 + if: matrix.friendlyName != 'Ubuntu' + with: + python-version: '3.11' + - name: Use Node.js ${{ env.NODE_VERSION }} + if: matrix.friendlyName != 'Ubuntu' + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + - name: Get app version + id: version + run: echo version=$(jq -r ".version" app/package.json) >> $GITHUB_OUTPUT + - name: Package and test application in container + uses: shiftkey/desktop-ubuntu-arm-packaging + - name: Upload output artifacts + uses: actions/upload-artifact@v4 + with: + name: Ubuntu-arm-artifacts + path: | + dist/*.AppImage + dist/*.deb + dist/*.rpm + dist/*.sha256 + retention-days: 5 + amd64: + name: Ubuntu (amd64) + runs-on: ubuntu-latest + permissions: + contents: write + timeout-minutes: 60 + env: + npm_config_arch: x64 + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ inputs.repository || github.repository }} + ref: ${{ inputs.ref }} + submodules: recursive + - uses: actions/setup-python@v5 + if: matrix.friendlyName != 'Ubuntu' + with: + python-version: '3.11' + - name: Use Node.js ${{ env.NODE_VERSION }} + if: matrix.friendlyName != 'Ubuntu' + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + - name: Get app version + id: version + run: echo version=$(jq -r ".version" app/package.json) >> $GITHUB_OUTPUT + - name: Package and test application in container + uses: shiftkey/desktop-ubuntu-amd64-packaging + - name: Upload output artifacts + uses: actions/upload-artifact@v4 + with: + name: Ubuntu-amd64-artifacts + path: | + dist/*.AppImage + dist/*.deb + dist/*.rpm + dist/*.sha256 + retention-days: 5 + + publish: + name: Create GitHub release + needs: [arm64, arm, amd64, lint] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js 18.14.0 + uses: actions/setup-node@v4 + with: + node-version: 18.14.0 + cache: yarn + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: './artifacts' + + - name: Display structure of downloaded files + run: ls -R + working-directory: './artifacts' + + - name: Get tag name without prefix + run: | + RELEASE_TAG=${GITHUB_REF/refs\/tags\//} + echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV + tagNameWithoutPrefix="${RELEASE_TAG:8}" + echo "RELEASE_TAG_WITHOUT_PREFIX=${tagNameWithoutPrefix}" >> $GITHUB_ENV + + # TODO: generate release notes + # - pull in default if version matches X.Y.Z-linux1 + # - otherwise stub template + + - name: Generate release notes + run: | + node -v + yarn + node -r ts-node/register script/generate-release-notes.ts "${{ github.workspace }}/artifacts" "${{ env.RELEASE_TAG_WITHOUT_PREFIX }}" + RELEASE_NOTES_FILE=script/release_notes.txt + if [[ ! -f "$RELEASE_NOTES_FILE" ]]; then + echo "$RELEASE_NOTES_FILE does not exist. Something might have gone wrong while generating the release notes." + exit 1 + fi + echo "Release notes:" + echo "---" + cat ${RELEASE_NOTES_FILE} + echo "---" + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + name: GitHub Desktop for Linux ${{ env.RELEASE_TAG_WITHOUT_PREFIX }} + body_path: script/release_notes.txt + files: | + artifacts/**/*.AppImage + artifacts/**/*.deb + artifacts/**/*.rpm + artifacts/**/*.sha256 + draft: true + fail_on_unmatched_files: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}