This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
Update github actions #4359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: goreleaser | |
defaults: | |
run: | |
shell: bash --noprofile --norc -eo pipefail {0} | |
on: | |
push: | |
branches: [master, main, force_test, release-*, staging, trying] | |
tags: ['*'] | |
pull_request: | |
branches: ['**'] | |
env: | |
golang-version: 1.22.1 | |
goreleaser-version: v1.24.0 | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Set up Go | |
uses: actions/[email protected] | |
with: | |
go-version: ${{ env.golang-version }} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
#login only on tags. Note that login can't work on PRs from forked repos because of missing secrets | |
#this gets around that by only logging in when needed. | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Run GoReleaser Test | |
uses: goreleaser/goreleaser-action@v4 | |
# do not run test if actually releasing | |
if: startsWith(github.ref, 'refs/tags/') != true | |
with: | |
distribution: goreleaser | |
version: ${{ env.goreleaser-version }} | |
args: release --snapshot --skip-publish --rm-dist -f .goreleaser.yml | |
- | |
name: GoReleaser Release | |
uses: goreleaser/goreleaser-action@v4 | |
#release only on tags | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
distribution: goreleaser | |
version: ${{ env.goreleaser-version }} | |
args: release --rm-dist -f .goreleaser.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install package_cloud | |
run: | | |
sudo gem install package_cloud --no-doc | |
- name: Upload to packagecloud when on release branch | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
PACKAGECLOUD_TOKEN: ${{ secrets.IO_PACKAGECLOUD_TOKEN }} | |
DEBIAN_DISTROS: debian/stretch debian/buster debian/bullseye ubuntu/bionic ubuntu/focal ubuntu/hirsute ubuntu/impish ubuntu/jammy | |
RHEL_DISTROS: el/7 el/8 | |
run: | | |
version="$(echo "${GITHUB_REF}" | sed -e 's|refs/tags/||')"; | |
# a dash indicates a pre-release version in semver | |
if [[ "$version" =~ '-' ]]; then \ | |
repo='timescale/timescaledb-exp'; \ | |
else \ | |
repo='timescale/timescaledb'; \ | |
fi; | |
ls dist/*.deb | |
for distro in ${DEBIAN_DISTROS}; do | |
package_cloud push "${repo}/${distro}" dist/*.deb | |
done | |
ls dist/*.rpm | |
for distro in ${RHEL_DISTROS}; do | |
package_cloud push "${repo}/${distro}" dist/*.rpm | |
done |