diff --git a/.github/workflows/4testing-build.yml b/.github/workflows/4testing-build.yml new file mode 100644 index 0000000..b82c0c2 --- /dev/null +++ b/.github/workflows/4testing-build.yml @@ -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 + diff --git a/.github/workflows/publish-artifact.yml b/.github/workflows/publish-artifact.yml new file mode 100644 index 0000000..dea0655 --- /dev/null +++ b/.github/workflows/publish-artifact.yml @@ -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 +