Skip to content

Merge pull request #941 from aziontech/dev #163

Merge pull request #941 from aziontech/dev

Merge pull request #941 from aziontech/dev #163

Workflow file for this run

name: Deploy to Production
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.22.5
outputs:
binver: ${{ steps.binversion.outputs.BIN_VERSION }}
env:
CGO_ENABLED: 0 # Statically linked
steps:
- name: Setting GIT
run: git config --global url."https://${{ secrets.GLOBAL_TOKEN }}:[email protected]/aziontech".insteadOf "https://github.com/aziontech"
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setting up a secure repository
run: git config --global --add safe.directory /__w/azion/azion
- name: Bump version and push tag
id: tag_ver
uses: anothrNick/[email protected]
env:
RELEASE_BRANCHES: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Refresh git
run: git fetch --tags
- name: Build
env:
STORAGE_API: ${{ secrets.STORAGE_API_STAGE }}
run: make build ENVFILE=./env/prod
- name: Cross-build
env:
STORAGE_API: ${{ secrets.STORAGE_API_STAGE }}
run: make cross-build ENVFILE=./env/prod
- name: Install AWS CLI
run: |
apt update
apt install -y awscli
- name: Configure AWS Credentials (azion-downloads)
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.CLI_S3_DOWNLOADS_ID }}
aws-secret-access-key: ${{ secrets.CLI_S3_DOWNLOADS_SECRET }}
aws-region: us-east-1
- name: Upload to azion-downloads production dir
run: |
while read spec; \
do\
distro=$(echo ${spec} | cut -d/ -f1);\
goarch=$(echo ${spec} | cut -d/ -f2);\
arch=$(echo ${goarch} | sed 's/386/x86_32/g; s/amd64/x86_64/g; s/arm$/arm32/g;');\
cp dist/$distro/$arch/azion* dist/$distro/$arch/azion;
aws s3 cp --no-progress --recursive \
--exclude "*" --include "azion*" \
dist/$distro/$arch/ s3://azion-downloads/$distro/$arch/; \
done < BUILD
- id: binversion
run: echo "BIN_VERSION=$(git describe --tags)" >> $GITHUB_OUTPUT
- name: set bin version to github env
run: echo "BIN_VERSION=$(git describe --tags)" >> $GITHUB_ENV
- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
API_URL: https://api.azionapi.net
STORAGE_URL: https://api.azion.com
AUTH_URL: https://sso.azion.com/api
TEMPLATE_BRANCH: main
SEGMENT_KEY: Irg63QfdvWpoANAVeCBEwfxXBKvoSSzt
bump_formula:
runs-on: ubuntu-latest
needs: build
steps:
- uses: dawidd6/action-homebrew-bump-formula@v3
with:
token: ${{secrets.RELEASE_GITHUB_TOKEN}}
formula: azion
tag: ${{needs.build.outputs.binver}}