Skip to content

Commit

Permalink
Add actions for test build
Browse files Browse the repository at this point in the history
  • Loading branch information
romandemidov committed Dec 26, 2024
1 parent 1300b37 commit 78edfa1
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/4testing-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and publish SNAP package

run-name: Build ONLYOFFICE_Docs-${{ github.event.inputs.version }}-${{ github.event.inputs.build }}

on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Version'
required: true
build:
description: 'Build number'
type: string
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Replace Version and Build Number
id: repl
run: |
VERSION=${{ github.event.inputs.version }}
BUILD_NUMBER=${{ github.event.inputs.build }}
#replace version
sed -i -r "/version:/s/([0-9]+).([0-9]+).([0-9]+)/${VERSION}/" ./snap/snapcraft.yaml
#replace link to archive to test
#x64
sed -i -e '/amd64:/s|https://download.onlyoffice.com/install/document|https://s3.eu-west-1.amazonaws.com/repo-doc-onlyoffice-com/|' ./snap/snapcraft.yaml
sed -i -e '/amd64:/s|server/linux/|server/linux/snap/|' ./snap/snapcraft.yaml
sed -i -e "/amd64:/s|_x86_64|-${BUILD_NUMBER}-x86_64|" ./snap/snapcraft.yaml
#arm
sed -i -e '/arm64:/s|https://download.onlyoffice.com/install/document|https://s3.eu-west-1.amazonaws.com/repo-doc-onlyoffice-com/|' ./snap/snapcraft.yaml
sed -i -e '/arm64:/s|server/linux/|server/linux/snap/|' ./snap/snapcraft.yaml
sed -i -e "/arm64:/s|_aarch64|-${BUILD_NUMBER}-aarch64|" ./snap/snapcraft.yaml
- name: Build snap
uses: snapcore/action-build@v1
id: build

- name: Publish snap
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
with:
snap: ${{ steps.build.outputs.snap }}
release: beta

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ONLYOFFICE_Docs-${{ github.event.inputs.version }}-${{ github.event.inputs.build }}
path: ${{ steps.build.outputs.snap }}
retention-days: 14

46 changes: 46 additions & 0 deletions .github/workflows/publish-artifact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish SNAP arfifact

run-name: Publish ONLYOFFICE_Docs-${{ github.event.inputs.version }}-${{ github.event.inputs.build }}

on:
workflow_dispatch:
inputs:
version:
type: string
description: 'Version'
required: true
build:
description: 'Build number'
type: string
required: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get artifact
run: |
VERSION=${{ github.event.inputs.version }}
BUILD_NUMBER=${{ github.event.inputs.build }}
#
jq --version
REPO_URL="https://api.github.com/repos/ONLYOFFICE/snap-documentserver/actions/artifacts"
QUERY="curl -L $REPO_URL"
JQ_QUERY=".artifacts | .[] | select(.name | test(\"$VERSION-$BUILD_NUMBER\"))"
ARTIFACT_ID=`$QUERY | jq "$JQ_QUERY | .id"`
curl -o package.zip -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
$REPO_URL/$ARTIFACT_ID/zip
unzip package.zip
mv *.snap package.snap
- name: Publish snap
uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
with:
snap: package.snap
release: beta

0 comments on commit 78edfa1

Please sign in to comment.