From 89e4d7b787e58b54ff7a7806737fa1a120bb9df0 Mon Sep 17 00:00:00 2001 From: Frieder Bluemle Date: Tue, 21 Sep 2021 15:17:23 +0200 Subject: [PATCH] ci: Do not run upload action on forks --- .github/workflows/gen_centos7_continuous.yml | 1 + .github/workflows/gen_centos7_tag.yml | 1 + .github/workflows/gen_centos8_continuous.yml | 1 + .github/workflows/gen_centos8_tag.yml | 1 + .github/workflows/gen_debian10.3_continuous.yml | 1 + .github/workflows/gen_debian10.3_tag.yml | 1 + .github/workflows/gen_debian11_continuous.yml | 1 + .github/workflows/gen_debian11_tag.yml | 1 + .github/workflows/gen_debian9.12_continuous.yml | 1 + .github/workflows/gen_debian9.12_tag.yml | 1 + .github/workflows/gen_fedora31_continuous.yml | 1 + .github/workflows/gen_fedora31_tag.yml | 1 + .github/workflows/gen_fedora32_continuous.yml | 1 + .github/workflows/gen_fedora32_tag.yml | 1 + .github/workflows/gen_fedora33_continuous.yml | 1 + .github/workflows/gen_fedora33_tag.yml | 1 + .github/workflows/gen_fedora34_continuous.yml | 1 + .github/workflows/gen_fedora34_tag.yml | 1 + .github/workflows/gen_macos_continuous.yml | 1 + .github/workflows/gen_macos_tag.yml | 1 + .github/workflows/gen_ubuntu16_continuous.yml | 1 + .github/workflows/gen_ubuntu16_tag.yml | 1 + .github/workflows/gen_ubuntu18_continuous.yml | 1 + .github/workflows/gen_ubuntu18_tag.yml | 1 + .github/workflows/gen_ubuntu20.04_continuous.yml | 1 + .github/workflows/gen_ubuntu20.04_tag.yml | 1 + .github/workflows/gen_windows_continuous.yml | 1 + .github/workflows/gen_windows_tag.yml | 1 + ci/generate-workflows.py | 7 ++++++- 29 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gen_centos7_continuous.yml b/.github/workflows/gen_centos7_continuous.yml index 91882880c..8a58bd9c0 100644 --- a/.github/workflows/gen_centos7_continuous.yml +++ b/.github/workflows/gen_centos7_continuous.yml @@ -143,6 +143,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_centos7_tag.yml b/.github/workflows/gen_centos7_tag.yml index 2d0e7e737..0fb6e8c6a 100644 --- a/.github/workflows/gen_centos7_tag.yml +++ b/.github/workflows/gen_centos7_tag.yml @@ -90,6 +90,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_centos8_continuous.yml b/.github/workflows/gen_centos8_continuous.yml index 5ac296170..fbb70d564 100644 --- a/.github/workflows/gen_centos8_continuous.yml +++ b/.github/workflows/gen_centos8_continuous.yml @@ -126,6 +126,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_centos8_tag.yml b/.github/workflows/gen_centos8_tag.yml index 3ab241ac0..0ad0a6812 100644 --- a/.github/workflows/gen_centos8_tag.yml +++ b/.github/workflows/gen_centos8_tag.yml @@ -71,6 +71,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_debian10.3_continuous.yml b/.github/workflows/gen_debian10.3_continuous.yml index 881accbf2..48d18298b 100644 --- a/.github/workflows/gen_debian10.3_continuous.yml +++ b/.github/workflows/gen_debian10.3_continuous.yml @@ -119,6 +119,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz" release-tag: "nightly" diff --git a/.github/workflows/gen_debian10.3_tag.yml b/.github/workflows/gen_debian10.3_tag.yml index 67e30fdb7..f7cae3f59 100644 --- a/.github/workflows/gen_debian10.3_tag.yml +++ b/.github/workflows/gen_debian10.3_tag.yml @@ -68,6 +68,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_debian11_continuous.yml b/.github/workflows/gen_debian11_continuous.yml index 3e1a4645b..545777ce1 100644 --- a/.github/workflows/gen_debian11_continuous.yml +++ b/.github/workflows/gen_debian11_continuous.yml @@ -119,6 +119,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz" release-tag: "nightly" diff --git a/.github/workflows/gen_debian11_tag.yml b/.github/workflows/gen_debian11_tag.yml index 0506ee32e..66ab2a838 100644 --- a/.github/workflows/gen_debian11_tag.yml +++ b/.github/workflows/gen_debian11_tag.yml @@ -68,6 +68,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_debian9.12_continuous.yml b/.github/workflows/gen_debian9.12_continuous.yml index 315b4930e..67b20cb6f 100644 --- a/.github/workflows/gen_debian9.12_continuous.yml +++ b/.github/workflows/gen_debian9.12_continuous.yml @@ -136,6 +136,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz" release-tag: "nightly" diff --git a/.github/workflows/gen_debian9.12_tag.yml b/.github/workflows/gen_debian9.12_tag.yml index 446ff0135..7dda04f04 100644 --- a/.github/workflows/gen_debian9.12_tag.yml +++ b/.github/workflows/gen_debian9.12_tag.yml @@ -87,6 +87,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_fedora31_continuous.yml b/.github/workflows/gen_fedora31_continuous.yml index d1c840b90..0f5f0e0dd 100644 --- a/.github/workflows/gen_fedora31_continuous.yml +++ b/.github/workflows/gen_fedora31_continuous.yml @@ -112,6 +112,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_fedora31_tag.yml b/.github/workflows/gen_fedora31_tag.yml index 479a5518d..6bde012ac 100644 --- a/.github/workflows/gen_fedora31_tag.yml +++ b/.github/workflows/gen_fedora31_tag.yml @@ -65,6 +65,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_fedora32_continuous.yml b/.github/workflows/gen_fedora32_continuous.yml index c21a67db1..a6ca64b72 100644 --- a/.github/workflows/gen_fedora32_continuous.yml +++ b/.github/workflows/gen_fedora32_continuous.yml @@ -112,6 +112,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_fedora32_tag.yml b/.github/workflows/gen_fedora32_tag.yml index 701e87f85..2d8eceb62 100644 --- a/.github/workflows/gen_fedora32_tag.yml +++ b/.github/workflows/gen_fedora32_tag.yml @@ -65,6 +65,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_fedora33_continuous.yml b/.github/workflows/gen_fedora33_continuous.yml index 4a85c40e8..156084652 100644 --- a/.github/workflows/gen_fedora33_continuous.yml +++ b/.github/workflows/gen_fedora33_continuous.yml @@ -112,6 +112,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_fedora33_tag.yml b/.github/workflows/gen_fedora33_tag.yml index 9c028aa0a..accb120f1 100644 --- a/.github/workflows/gen_fedora33_tag.yml +++ b/.github/workflows/gen_fedora33_tag.yml @@ -65,6 +65,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_fedora34_continuous.yml b/.github/workflows/gen_fedora34_continuous.yml index a820138c6..2acfd5542 100644 --- a/.github/workflows/gen_fedora34_continuous.yml +++ b/.github/workflows/gen_fedora34_continuous.yml @@ -112,6 +112,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" release-tag: "nightly" diff --git a/.github/workflows/gen_fedora34_tag.yml b/.github/workflows/gen_fedora34_tag.yml index a2f887845..543cf5c68 100644 --- a/.github/workflows/gen_fedora34_tag.yml +++ b/.github/workflows/gen_fedora34_tag.yml @@ -65,6 +65,7 @@ jobs: run: "mv ~/rpmbuild/RPMS/*/*.rpm ." - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "wezterm-*.rpm" prerelease: true diff --git a/.github/workflows/gen_macos_continuous.yml b/.github/workflows/gen_macos_continuous.yml index de583e03d..b29a7e22d 100644 --- a/.github/workflows/gen_macos_continuous.yml +++ b/.github/workflows/gen_macos_continuous.yml @@ -112,6 +112,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "WezTerm-*.zip" release-tag: "nightly" diff --git a/.github/workflows/gen_macos_tag.yml b/.github/workflows/gen_macos_tag.yml index d32b2ffce..48cd79230 100644 --- a/.github/workflows/gen_macos_tag.yml +++ b/.github/workflows/gen_macos_tag.yml @@ -85,6 +85,7 @@ jobs: - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: "WezTerm-*.zip" prerelease: true diff --git a/.github/workflows/gen_ubuntu16_continuous.yml b/.github/workflows/gen_ubuntu16_continuous.yml index dc2ff54ca..a1ddad631 100644 --- a/.github/workflows/gen_ubuntu16_continuous.yml +++ b/.github/workflows/gen_ubuntu16_continuous.yml @@ -119,6 +119,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz;*.AppImage;*.zsync" release-tag: "nightly" diff --git a/.github/workflows/gen_ubuntu16_tag.yml b/.github/workflows/gen_ubuntu16_tag.yml index c7f46c76b..7e0602717 100644 --- a/.github/workflows/gen_ubuntu16_tag.yml +++ b/.github/workflows/gen_ubuntu16_tag.yml @@ -68,6 +68,7 @@ jobs: run: "bash ci/appimage.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_ubuntu18_continuous.yml b/.github/workflows/gen_ubuntu18_continuous.yml index e51f98826..9c65a413c 100644 --- a/.github/workflows/gen_ubuntu18_continuous.yml +++ b/.github/workflows/gen_ubuntu18_continuous.yml @@ -105,6 +105,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz" release-tag: "nightly" diff --git a/.github/workflows/gen_ubuntu18_tag.yml b/.github/workflows/gen_ubuntu18_tag.yml index 9c7181c55..9374ef74e 100644 --- a/.github/workflows/gen_ubuntu18_tag.yml +++ b/.github/workflows/gen_ubuntu18_tag.yml @@ -62,6 +62,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_ubuntu20.04_continuous.yml b/.github/workflows/gen_ubuntu20.04_continuous.yml index 11f188b90..577ef2de9 100644 --- a/.github/workflows/gen_ubuntu20.04_continuous.yml +++ b/.github/workflows/gen_ubuntu20.04_continuous.yml @@ -119,6 +119,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "wezterm-*.deb;wezterm-*.xz;wezterm-*.tar.gz" release-tag: "nightly" diff --git a/.github/workflows/gen_ubuntu20.04_tag.yml b/.github/workflows/gen_ubuntu20.04_tag.yml index 2b650f094..6af751139 100644 --- a/.github/workflows/gen_ubuntu20.04_tag.yml +++ b/.github/workflows/gen_ubuntu20.04_tag.yml @@ -68,6 +68,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | wezterm-*.deb diff --git a/.github/workflows/gen_windows_continuous.yml b/.github/workflows/gen_windows_continuous.yml index e7ac526ed..b9e74bce2 100644 --- a/.github/workflows/gen_windows_continuous.yml +++ b/.github/workflows/gen_windows_continuous.yml @@ -85,6 +85,7 @@ jobs: - name: "Upload to Nightly Release" uses: wez/upload-release-assets@releases/v1 + if: github.event.repository.fork == false with: files: "WezTerm-*.zip;WezTerm-*.exe" release-tag: "nightly" diff --git a/.github/workflows/gen_windows_tag.yml b/.github/workflows/gen_windows_tag.yml index 26626174c..1ce610f85 100644 --- a/.github/workflows/gen_windows_tag.yml +++ b/.github/workflows/gen_windows_tag.yml @@ -58,6 +58,7 @@ jobs: run: "bash ci/deploy.sh" - name: "Upload to Tagged Release" uses: softprops/action-gh-release@v1 + if: github.event.repository.fork == false with: files: | WezTerm-*.zip diff --git a/ci/generate-workflows.py b/ci/generate-workflows.py index c1e2532e6..651ee524e 100755 --- a/ci/generate-workflows.py +++ b/ci/generate-workflows.py @@ -47,15 +47,18 @@ class RunStep(Step): class ActionStep(Step): - def __init__(self, name, action, params=None, env=None): + def __init__(self, name, action, params=None, env=None, condition=None): self.name = name self.action = action self.params = params self.env = env + self.condition = condition def render(self, f, env): f.write(f" - name: {yv(self.name)}\n") f.write(f" uses: {self.action}\n") + if self.condition: + f.write(f" if: {self.condition}\n") if self.params: f.write(" with:\n") for k, v in self.params.items(): @@ -372,6 +375,7 @@ cargo build --all --release""", ActionStep( "Upload to Nightly Release", action="wez/upload-release-assets@releases/v1", + condition="github.event.repository.fork == false", params={ "files": ";".join(patterns), "release-tag": "nightly", @@ -392,6 +396,7 @@ cargo build --all --release""", ActionStep( "Upload to Tagged Release", action="softprops/action-gh-release@v1", + condition="github.event.repository.fork == false", params={"files": "\n".join(patterns), "prerelease": True}, env={ "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",