From ee1a788402fe0f0c6804e3cd68cdbdf301ad1172 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 21 Apr 2023 21:46:03 +0800 Subject: [PATCH] Switch to Actions (#161) Co-authored-by: techknowlogick Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/161 Reviewed-by: Lunny Xiao Reviewed-by: techknowlogick Co-authored-by: Jason Song Co-committed-by: Jason Song --- .drone.yml | 113 ------------------- {.github => .gitea}/issue_template.md | 0 {.github => .gitea}/pull_request_template.md | 0 .gitea/workflows/test.yml | 32 ++++++ .gitea/workflows/update.yaml | 21 ++++ bump_version.sh | 2 +- changelog.rb | 2 +- gitea-head.rb | 2 +- gitea.rb | 2 +- tea-head.rb | 2 +- tea.rb | 2 +- 11 files changed, 59 insertions(+), 119 deletions(-) delete mode 100644 .drone.yml rename {.github => .gitea}/issue_template.md (100%) rename {.github => .gitea}/pull_request_template.md (100%) create mode 100644 .gitea/workflows/test.yml create mode 100644 .gitea/workflows/update.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d619ff6..0000000 --- a/.drone.yml +++ /dev/null @@ -1,113 +0,0 @@ ---- -kind: pipeline -name: testing-amd64 - -platform: - os: linux - arch: amd64 - -trigger: - event: - - push - - pull_request - -steps: - - name: test-versioned-formulae - image: homebrew/brew:3.6.14 - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - commands: - - brew tap gitea/gitea "$${PWD}" - - brew install gitea/gitea/tea - - tea --version - - brew install gitea/gitea/gitea - - gitea --version - - - name: test-head-formulae - image: homebrew/brew:latest - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - commands: - - brew tap gitea/gitea "$${PWD}" - - brew install gitea/gitea/tea-head - - tea --version - - brew install gitea/gitea/changelog - - changelog --version - - brew install gitea/gitea/gitea-head - - gitea --version - ---- -kind: pipeline -name: testing-arm64 - -platform: - os: linux - arch: arm64 - -trigger: - event: - - push - - pull_request - -steps: - - name: test-versioned-formulae - image: markkrj/homebrew-arm:latest - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - commands: - - brew tap gitea/gitea "$${PWD}" - - brew install gitea/gitea/tea - - tea --version - - brew install gitea/gitea/gitea - - gitea --version - - - name: test-head-formulae - image: markkrj/homebrew-arm:latest - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - commands: - - brew tap gitea/gitea "$${PWD}" - - brew install gitea/gitea/tea-head - - tea --version - - brew install gitea/gitea/changelog - - changelog --version - - brew install gitea/gitea/gitea-head - - gitea --version - ---- -kind: pipeline -name: update_version - -platform: - os: linux - arch: amd64 - -trigger: - branch: - - main - event: - - cron - cron: - - update_version - -steps: - - name: update - image: alpine:3.17 - pull: always - commands: - - apk add --no-cache curl - - ./bump_version.sh - - - name: push - image: appleboy/drone-git-push:0.2.3-linux-amd64 - pull: always - settings: - author_email: "teabot@gitea.io" - author_name: GiteaBot - branch: main - commit: true - commit_message: "[skip ci] Updated Version via cron" - remote: "git@gitea.com:gitea/homebrew-gitea.git" - environment: - GIT_PUSH_SSH_KEY: - from_secret: git_push_ssh_key diff --git a/.github/issue_template.md b/.gitea/issue_template.md similarity index 100% rename from .github/issue_template.md rename to .gitea/issue_template.md diff --git a/.github/pull_request_template.md b/.gitea/pull_request_template.md similarity index 100% rename from .github/pull_request_template.md rename to .gitea/pull_request_template.md diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml new file mode 100644 index 0000000..3714295 --- /dev/null +++ b/.gitea/workflows/test.yml @@ -0,0 +1,32 @@ +name: test + +on: + - pull_request + - push + +jobs: + test: + strategy: + matrix: + brew_version: ["3.6.14", "latest"] + runs-on: ubuntu-latest + container: + image: homebrew/brew:${{ matrix.brew_version }} + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + steps: + - name: install node + # to use actions/checkout + run: | + brew install node + node --version + - uses: actions/checkout@v3 + - name: test install + run: | + brew tap gitea/gitea "${PWD}" + brew install gitea/gitea/tea + tea --version + brew install gitea/gitea/gitea + gitea --version + # TODO: test for arm + # There is no arm image for homebrew/brew, and the image markkrj/homebrew-arm hasn't been updated for years diff --git a/.gitea/workflows/update.yaml b/.gitea/workflows/update.yaml new file mode 100644 index 0000000..d994d42 --- /dev/null +++ b/.gitea/workflows/update.yaml @@ -0,0 +1,21 @@ +name: update + +on: + push: + branches: + - main + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: update + run: ./bump_version.sh + - name: commit + run: | + git config --global user.email "teabot@gitea.io" + git config --global user.name "GiteaBot" + git add --all + git commit -m "[skip ci] Updated Version via cron" || true + git push origin main diff --git a/bump_version.sh b/bump_version.sh index 368332e..7909f86 100755 --- a/bump_version.sh +++ b/bump_version.sh @@ -17,7 +17,7 @@ for bin in ${binaries};do latest=$(curl -sL -o /dev/null -w %{url_effective} "${git_url}/releases/latest") version="${latest##*/v}" - file_url="https://dl.gitea.io/${bin}/${version}" + file_url="https://dl.gitea.com/${bin}/${version}" for os in ${supported_os}; do sha256_file="${bin}-${version}-${os}" if [ "$os" != "linux-386" -a "$os" != "linux-arm64" ]; then diff --git a/changelog.rb b/changelog.rb index eac209d..9d3ee9b 100644 --- a/changelog.rb +++ b/changelog.rb @@ -15,7 +15,7 @@ class Changelog < Formula end @@filename = "changelog-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.io/changelog-tool/#{version}/#{@@filename}" + @@url = "https://dl.gitea.com/changelog-tool/#{version}/#{@@filename}" @@using = :nounzip if os == "darwin-10.12" || arch == "amd64" diff --git a/gitea-head.rb b/gitea-head.rb index 1f3e1e1..a633713 100644 --- a/gitea-head.rb +++ b/gitea-head.rb @@ -15,7 +15,7 @@ class GiteaHead < Formula end @@filename = "gitea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.io/gitea/#{version}/#{@@filename}" + @@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}" @@using = :nounzip if os == "darwin-10.12" || arch == "amd64" diff --git a/gitea.rb b/gitea.rb index e2c34d4..b7b05ef 100644 --- a/gitea.rb +++ b/gitea.rb @@ -15,7 +15,7 @@ class Gitea < Formula end @@filename = "gitea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.io/gitea/#{version}/#{@@filename}" + @@url = "https://dl.gitea.com/gitea/#{version}/#{@@filename}" @@using = :nounzip if os == "darwin-10.12" || arch == "amd64" diff --git a/tea-head.rb b/tea-head.rb index 3af96c1..9e65d0a 100644 --- a/tea-head.rb +++ b/tea-head.rb @@ -15,7 +15,7 @@ class TeaHead < Formula end @@filename = "tea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.io/tea/#{version}/#{@@filename}" + @@url = "https://dl.gitea.com/tea/#{version}/#{@@filename}" @@using = :nounzip if os == "darwin" || arch == "amd64" diff --git a/tea.rb b/tea.rb index a58fe13..8ec839c 100644 --- a/tea.rb +++ b/tea.rb @@ -15,7 +15,7 @@ class Tea < Formula end @@filename = "tea-#{version}-#{os}-#{arch}" - @@url = "https://dl.gitea.io/tea/#{version}/#{@@filename}" + @@url = "https://dl.gitea.com/tea/#{version}/#{@@filename}" @@using = :nounzip if os == "darwin" || arch == "amd64"