Merge pull request #1081 from aziontech/updated-sync #763
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: Deploy to Stage | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.22.12 | |
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 }} | |
PRERELEASE_SUFFIX: dev | |
- name: Refresh git | |
run: git fetch --tags | |
- name: Build | |
env: | |
AZION_API: ${{ secrets.AZION_API_STAGE }} | |
AZION_SSO: ${{ secrets.AZION_SSO_STAGE }} | |
STORAGE_API: ${{ secrets.STORAGE_API_STAGE }} | |
CONSOLE_URL: ${{ secrets.CONSOLE_STAGE }} | |
run: make build ENVFILE=./env/stage | |
- name: Cross-build | |
env: | |
AZION_API: ${{ secrets.AZION_API_STAGE }} | |
AZION_SSO: ${{ secrets.AZION_SSO_STAGE }} | |
STORAGE_API: ${{ secrets.STORAGE_API_STAGE }} | |
CONSOLE_URL: ${{ secrets.CONSOLE_STAGE }} | |
run: make cross-build ENVFILE=./env/stage | |
- 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 stage 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/stage/$distro/$arch/; \ | |
done < BUILD |