Skip to content

Commit

Permalink
Check the automatic posting of the offline release
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-antonyuk committed Dec 26, 2024
1 parent 50016a4 commit 971295f
Showing 1 changed file with 53 additions and 29 deletions.
82 changes: 53 additions & 29 deletions .github/workflows/offline-release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Upload offline self-extracting archive

on:
push:
tags:
- 'v*.*.*-server'
branches:
- 'feature/release-offline'
workflow_dispatch:

jobs:
Expand All @@ -11,35 +16,54 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set environment variables
- name: Trigger creation of an offline archive
run: |
DOCKER_VERSION=$(curl -s https://hub.docker.com/v2/repositories/onlyoffice/4testing-docspace-api/tags/ | jq -r '.results[].name' | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
echo "ARTIFACT_NAME=offline-docspace-installation.sh" >> $GITHUB_ENV
echo "ARTIFACT_VERSION_NAME=offline-docspace-${DOCKER_VERSION}-installation.sh" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_OCI }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_OCI }}
aws-region: us-east-1

- name: Upload offline self-extracting archive (latest)
run: |
aws s3 cp ${{ secrets.AWS_BUCKET_URL_OCI }}/4testing-${{ env.ARTIFACT_NAME }} \
${{ secrets.AWS_BUCKET_URL_OCI }}/${{ env.ARTIFACT_NAME }} \
--acl public-read \
--metadata-directive REPLACE
RESPONSE=$(curl -s -X POST -H "Accept: application/vnd.github.everest-preview+json" \
-u "${{ secrets.USERNAME }}:${{ secrets.TOKEN }}" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/actions/workflows/103532315/dispatches" \
--data '{"ref":"'"${{ github.ref }}"'"}')
echo "API Response: $RESPONSE"
ACTION_RUN_ID=$(echo "$RESPONSE" | jq -r '.workflow_run.id')
[[ -z "${ACTION_RUN_ID}" || "${ACTION_RUN_ID}" == "null" ]] && { echo "Failed to initiate the workflow."; exit 1; }
- name: Upload offline self-extracting archive (versioned)
run: |
aws s3 cp ${{ secrets.AWS_BUCKET_URL_OCI }}/4testing-${{ env.ARTIFACT_NAME }} \
${{ secrets.AWS_BUCKET_URL_OCI }}/${{ env.ARTIFACT_VERSION_NAME }} \
--acl public-read \
--metadata-directive REPLACE
while ACTION_STATUS=$(curl -s -u "${{ secrets.USERNAME }}:${{ secrets.TOKEN }}" \
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/actions/runs/${ACTION_RUN_ID}" | jq -r '.status'); [[ "${ACTION_STATUS}" != "completed" ]]; do
echo "Current workflow status: ${ACTION_STATUS}"
sleep 10
done
- name: Invalidate AWS CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.AWS_DISTRIBUTION_ID_OCI }} \
--paths "/docspace/${{ env.ARTIFACT_NAME }}" "/docspace/${{ env.ARTIFACT_VERSION_NAME }}"
ACTION_RESULT=$(curl -s -u "${{ secrets.USERNAME }}:${{ secrets.TOKEN }}" "https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/actions/runs/${ACTION_RUN_ID}" | jq -r '.conclusion')
[[ "${ACTION_RESULT}" == "success" ]] && echo "Workflow completed successfully." || { echo "Workflow failed."; exit 1; }
# - name: Set environment variables
# run: |
# DOCKER_VERSION=$(curl -s https://hub.docker.com/v2/repositories/onlyoffice/4testing-docspace-api/tags/ | jq -r '.results[].name' | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
# echo "ARTIFACT_NAME=offline-docspace-installation.sh" >> $GITHUB_ENV
# echo "ARTIFACT_VERSION_NAME=offline-docspace-${DOCKER_VERSION}-installation.sh" >> $GITHUB_ENV

# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_OCI }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_OCI }}
# aws-region: us-east-1

# - name: Upload offline self-extracting archive (latest)
# run: |
# aws s3 cp ${{ secrets.AWS_BUCKET_URL_OCI }}/4testing-${{ env.ARTIFACT_NAME }} \
# ${{ secrets.AWS_BUCKET_URL_OCI }}/${{ env.ARTIFACT_NAME }} \
# --acl public-read \
# --metadata-directive REPLACE

# - name: Upload offline self-extracting archive (versioned)
# run: |
# aws s3 cp ${{ secrets.AWS_BUCKET_URL_OCI }}/4testing-${{ env.ARTIFACT_NAME }} \
# ${{ secrets.AWS_BUCKET_URL_OCI }}/${{ env.ARTIFACT_VERSION_NAME }} \
# --acl public-read \
# --metadata-directive REPLACE

# - name: Invalidate AWS CloudFront cache
# run: |
# aws cloudfront create-invalidation \
# --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID_OCI }} \
# --paths "/docspace/${{ env.ARTIFACT_NAME }}" "/docspace/${{ env.ARTIFACT_VERSION_NAME }}"

0 comments on commit 971295f

Please sign in to comment.