Merge pull request #221 from wrwrabbit/merge/522 #422
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: Snap. | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
- 'changelog.txt' | |
- 'LEGAL' | |
- 'LICENSE' | |
- '.github/**' | |
- 'Telegram/build/**' | |
- 'Telegram/Resources/uwp/**' | |
- 'Telegram/Resources/winrc/**' | |
- 'Telegram/SourceFiles/platform/win/**' | |
- 'Telegram/SourceFiles/platform/mac/**' | |
- 'Telegram/Telegram/**' | |
- 'Telegram/configure.bat' | |
- 'Telegram/Telegram.plist' | |
pull_request: | |
types: [opened, reopened] | |
branches-ignore: | |
- 'compare/**' | |
workflow_dispatch: | |
inputs: | |
buildCommit: | |
description: 'Commit for building. Default it latest on branch' | |
required: false | |
type: string | |
default: '' | |
jobs: | |
snap: | |
name: Ubuntu | |
runs-on: ubuntu-20.04 | |
if: github.repository != 'cpartisans/tdesktop' | |
env: | |
UPLOAD_ARTIFACT: "true" | |
ARTIFACT_NAME: "Snap-PTelegram" | |
steps: | |
- name: Clone. | |
uses: actions/checkout@v4 | |
if: github.event.inputs.buildCommit == '' | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Clone with checkout. | |
uses: actions/checkout@v4 | |
if: github.event.inputs.buildCommit != '' | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: ${{ github.event.inputs.buildCommit }} | |
- name: First set up. | |
run: | | |
sudo iptables -P FORWARD ACCEPT | |
sudo snap install --classic snapcraft | |
sudo usermod -aG lxd $USER | |
sudo snap run lxd init --auto | |
sudo snap run lxd waitready | |
sed -i 's/$API_ID/${{ secrets.API_ID }}/g' snap/snapcraft.yaml | |
sed -i 's/$API_HASH/${{ secrets.API_HASH }}/g' snap/snapcraft.yaml | |
- name: Free up some disk space. | |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
- name: Telegram Desktop snap build. | |
run: sg lxd -c 'snap run snapcraft --verbosity=debug' | |
- name: Move and hash artifact. | |
if: env.UPLOAD_ARTIFACT == 'true' | |
run: | | |
rm snap/snapcraft.yaml | |
artifact_name=$(echo telegram-desktop_*.snap) | |
echo "ARTIFACT_NAME=$artifact_name" >> $GITHUB_ENV | |
mkdir artifact | |
mv $artifact_name artifact/ | |
- uses: actions/upload-artifact@v4 | |
if: env.UPLOAD_ARTIFACT == 'true' | |
name: Upload artifact. | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: artifact |