generate: autoupdate #378
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: publish | |
on: | |
push: | |
branches: [master] | |
tags: ['*'] | |
workflow_dispatch: | |
env: | |
GO_VERSION: '>=1.21.2' | |
jobs: | |
create-packages-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Build OpenSSL 3.0 | |
run: | | |
wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz | |
tar -xvf openssl-3.0.8.tar.gz | |
cd openssl-3.0.8/ | |
./Configure --prefix=${GITHUB_WORKSPACE}/openssl no-shared | |
make && make install | |
- name: Setup GoReleaser | |
run: | | |
curl -O -L https://github.com/goreleaser/goreleaser/releases/download/v1.12.3/goreleaser_1.12.3_amd64.deb | |
sudo dpkg -i goreleaser_1.12.3_amd64.deb | |
rm goreleaser_1.12.3_amd64.deb | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --skip-validate" | |
else | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --snapshot" | |
fi | |
# These scripts will be picked up while building packages with goreleaser. | |
- name: Generate ZSH and Bash completion scripts | |
run: | | |
mage build | |
./tt completion bash > tt-completion.bash | |
./tt completion zsh > tt-completion.zsh | |
- name: Build packages | |
env: | |
CGO_LDFLAGS: "-L${{ env.GITHUB_WORKSPACE }}/openssl/lib64" | |
CGO_CFLAGS: "-I${{ env.GITHUB_WORKSPACE }}/openssl/include" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
goreleaser release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --skip-publish --config ./goreleaser/.goreleaser_linux.yml | |
- name: Upload packages artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-linux | |
path: dist | |
create-packages-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Build OpenSSL 3.0 | |
run: | | |
wget https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz | |
tar -xvf openssl-3.0.8.tar.gz | |
cd openssl-3.0.8/ | |
./Configure --prefix=${GITHUB_WORKSPACE}/openssl no-shared | |
make && make install | |
- name: Setup GoReleaser | |
run: | | |
brew install goreleaser | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --skip-validate" | |
else | |
echo "::set-output name=GORELEASER_FLAGS::--rm-dist --snapshot" | |
fi | |
- name: Build packages | |
env: | |
CGO_LDFLAGS: "-L${{ env.GITHUB_WORKSPACE }}/openssl/lib64" | |
CGO_CFLAGS: "-I${{ env.GITHUB_WORKSPACE }}/openssl/include" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
goreleaser release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --skip-publish --config ./goreleaser/.goreleaser_macOS.yml | |
- name: Upload packages artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-macos | |
path: dist | |
draft-release: | |
needs: [create-packages-linux, create-packages-macos] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Make directories | |
run: | | |
mkdir -p ./dist-prebuilt/packages-linux | |
mkdir -p ./dist-prebuilt/packages-macos | |
- name: Download linux binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-linux | |
path: ./dist-prebuilt/packages-linux | |
- name: Download macos binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-macos | |
path: ./dist-prebuilt/packages-macos | |
- name: Remove not-needed files | |
run: | | |
rm ./dist-prebuilt/packages-linux/artifacts.json | |
rm ./dist-prebuilt/packages-linux/config.yaml | |
rm ./dist-prebuilt/packages-linux/metadata.json | |
rm ./dist-prebuilt/packages-macos/artifacts.json | |
rm ./dist-prebuilt/packages-macos/config.yaml | |
rm ./dist-prebuilt/packages-macos/metadata.json | |
rm ./dist-prebuilt/packages-macos/tt_darwin_amd64_v1/tt | |
rm ./dist-prebuilt/packages-linux/tt_linux_amd64_v1/tt | |
- name: Pack additional archives | |
run: | | |
./.gen_tarballs.sh -t ${{ github.ref_name }} | |
mv /tmp/gentoo_tarballs/tt*.tar.* ./dist-prebuilt/packages-linux/ | |
- name: merge checksum file | |
run: | | |
cd ./dist-prebuilt | |
cat ./packages-linux/tt*checksums.txt >> checksums.txt | |
cat ./packages-macos/tt*checksums.txt >> checksums.txt | |
rm ./packages-linux/tt*checksums.txt | |
rm ./packages-macos/tt*checksums.txt | |
mv checksums.txt ./packages-macos/ | |
- name: Set GoReleaser flags | |
id: set-goreleaser-flags | |
run: | | |
if ${{ startsWith(github.ref, 'refs/tags') }} ; then | |
echo "GORELEASER_FLAGS=--skip-validate" >> $GITHUB_OUTPUT | |
else | |
echo "GORELEASER_FLAGS=--snapshot" >> $GITHUB_OUTPUT | |
fi | |
- name: Release | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
args: release ${{ steps.set-goreleaser-flags.outputs.GORELEASER_FLAGS }} --config ./goreleaser/.goreleaser_publish.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-s3: | |
needs: create-packages-linux | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup Mage | |
run: | | |
git clone https://github.com/magefile/mage | |
cd mage | |
go run bootstrap.go | |
- name: Download packages artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: packages-linux | |
path: dist | |
- name: Publish packages to RWS | |
env: | |
RWS_URL_PART: https://rws.tarantool.org/release/modules | |
RWS_AUTH: ${{ secrets.RWS_AUTH }} | |
run: mage publishRWS |