Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change logic to build stage image #2720

Merged
merged 11 commits into from
Nov 26, 2024
28 changes: 16 additions & 12 deletions .github/workflows/build_stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ jobs:
- name: Debug
run: ls -la

- name: Replace space by "-"
- name: Replace space and underscore by "-"
run: |
for file in *; do
if [ -f "$file" ]; then
new_name=$(echo "$file" | tr ' ' '-')
if [ "$new_name" != "$file" ]; then # Skip files with no spaces
# Replace both spaces and underscores with hyphens
new_name=$(echo "$file" | tr ' _' '-')
if [ "$new_name" != "$file" ]; then # Skip files with no spaces or underscores
mv "$file" "$new_name"
fi
fi
Expand All @@ -160,7 +161,8 @@ jobs:
if [ -f "$artifact" ]; then
s3cmd sync "$artifact" --acl-public --multipart-chunk-size-mb=150 "${{ env.S3_BUCKET }}/pr-${{ github.event.pull_request.number }}/$artifact"
url=$(s3cmd signurl "${{ env.S3_BUCKET }}/pr-${{ github.event.pull_request.number }}/$artifact" $(echo "`date +%s` + 3600 * 24 * ${{ env.STORING_DAYS }}" | bc))
echo "::set-output name=$artifact_name::[$artifact]($url)"
# Escape the URL and format it differently
echo "::set-output name=$artifact_name::<a href=\"$url\">$artifact</a>"
fi
done
done
Expand All @@ -172,11 +174,13 @@ jobs:
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
👨‍💻 Stage build was created successfully, URLs to download:
- Windows: ${{ steps.interact_with_storage.outputs.windows_app }}
- Linux: ${{ steps.interact_with_storage.outputs.linux_app }}
- MacOS: ${{ steps.interact_with_storage.outputs.macos_app }}
- MacOS_arm: ${{ steps.interact_with_storage.outputs.macos_64_app }}

Branch: ${{ github.head_ref }}
PR: https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}
👨‍💻 Stage build was created successfully!
<b>Branch:</b> ${{ github.head_ref }}
<b>PR:</b> https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}

- <b>Windows:</b> ${{ steps.interact_with_storage.outputs.windows_app }}
- <b>Linux:</b> ${{ steps.interact_with_storage.outputs.linux_app }}
- <b>MacOS:</b> ${{ steps.interact_with_storage.outputs.macos_app }}
- <b>MacOS_arm:</b> ${{ steps.interact_with_storage.outputs.macos_64_app }}

<b>Stage web:</b> https://spektr-stg.novasama-tech.org/
16 changes: 14 additions & 2 deletions .github/workflows/docker_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ on:
push:
branches:
- dev
- stage
tags:
- 'v*'
pull_request:
types: [labeled]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-docker-images:
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.label.name, 'internal-build'))
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -41,8 +49,12 @@ jobs:
if: ${{ github.ref_type == 'branch' && github.ref_name == 'dev' }}
run: |
echo "IMAGE_LABEL=latest" >> "$GITHUB_ENV"
- name: Set image label for release branches
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "IMAGE_LABEL=stage" >> "$GITHUB_ENV"
- name: Set image label for a tag or other branches
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && github.ref_name != 'dev') }}
if: ${{ github.ref_type == 'tag' || (github.ref_type == 'branch' && github.ref_name != 'dev' && github.event_name != 'pull_request') }}
run: |
echo "IMAGE_LABEL=${{ github.ref_name }}" >> "$GITHUB_ENV"
- name: Set full name of the Docker image
Expand Down
Loading