Skip to content

Old Main

Old Main #63

Workflow file for this run

name: Release Build
on:
create:
tags:
- 'v*.*.*'
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout project
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache src
id: cache-src
uses: actions/upload-artifact@v3
with:
name: repo
path: ./*
build_arm64v8:
needs: setup
name: build for arm64v8
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: repo
path: ./
- name: Setup
run: |
chmod +wr . -R
chmod +x ./**/*.sh
chmod +x ./**/*.pl
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build in Docker
id: build
run: |
docker buildx build --platform linux/arm64 -t 4tqrgqe5yrgfd/figma-linux-artefacts-arm --load -f ./docker/Build_artefacts_arm64v8 .
mkdir -p ./build/installers
docker cp $(docker create 4tqrgqe5yrgfd/figma-linux-artefacts-arm)://usr/src/figma-linux/build/installers/. ./build/installers
perl ./scripts/generate_release_notes.pl
- name: Cache arm64v8 artifacts
id: cache-arm64v8-artifacts
uses: actions/upload-artifact@v3
with:
name: arm64v8
path: build/installers/*
release_arm64v8:
name: Upload arm64v8 assets
runs-on: ubuntu-latest
needs: build_arm64v8
steps:
- name: mkdir installers
run: mkdir -p ./build/installers
- uses: actions/download-artifact@v3
with:
name: arm64v8
path: ./build/installers
- name: Get version
id: version
run: |
echo ::set-output name=release::$(cat build/installers/version)
sha256sum ./build/installers/figma-linux* || echo ""
- name: Upload release assets
id: release
uses: ChugunovRoman/action-gh-release@master
if: startsWith(github.ref, 'refs/tags/')
with:
name: Figma Linux ${{ steps.version.outputs.release }}
files: build/installers/figma-linux*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_amd64:
runs-on: ubuntu-latest
name: build for amd64
needs: setup
steps:
- uses: actions/download-artifact@v3
with:
name: repo
path: ./
- name: Setup
run: |
chmod +wr . -R
chmod +x ./**/*.sh
chmod +x ./**/*.pl
- name: Build in Docker
id: build
run: |
docker build -t figma-linux-artefacts -f "./docker/Build_artefacts_local" --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) .
mkdir -p ./build/installers
docker cp $(docker create figma-linux-artefacts:latest)://usr/src/figma-linux/build/installers/. ./build/installers
mv ./build/installers/figma-linux_$(cat build/installers/version)_linux_x64.zip ./build/installers/figma-linux_$(cat build/installers/version)_linux_amd64.zip
perl ./scripts/generate_release_notes.pl
- name: Cache amd64 artifacts
id: cache-amd64-artifacts
uses: actions/upload-artifact@v3
with:
name: amd64
path: |
./release_notes
build/installers/*
release_amd64:
name: Upload amd64 assets
runs-on: ubuntu-latest
needs: build_amd64
steps:
- name: mkdir installers
run: mkdir -p ./build/installers
- uses: actions/download-artifact@v3
with:
name: amd64
path: ./
- name: Get version
id: version
run: |
echo ::set-output name=release::$(cat build/installers/version)
sha256sum ./build/installers/figma-linux* || echo ""
- name: Upload release assets
id: release
uses: ChugunovRoman/action-gh-release@master
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ./release_notes
name: Figma Linux ${{ steps.version.outputs.release }}
files: build/installers/figma-linux*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload_ppa_amd64:
name: Upload to Launchpad PPA
runs-on: ubuntu-latest
needs: build_amd64
steps:
- uses: actions/download-artifact@v3
with:
path: ./
- name: Import keys
run: |
mv ./repo/* ./
mv ./amd64/* ./
rm -rf ./repo
rm -rf ./amd64
chmod +x ./**/*.sh
chmod +x ./**/*.pl
mkdir ./gpg
echo "${{ secrets.GPG_PUB_KEY }}" | base64 -d > ./gpg/pub.key
echo "${{ secrets.GPG_SECRET_KEY }}" | base64 -d > ./gpg/secret.key
echo "${{ secrets.GPG_PASSPHRASE_KEY }}" | base64 -d > ./gpg/passphrase
echo "${{ secrets.ID_RSA }}" | base64 -d > ./gpg/id_rsa
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Upload PPA
run: |
./scripts/build_ppa.sh "1"
upload_aur:
name: Upload to AUR
runs-on: ubuntu-latest
needs: release_amd64
steps:
- uses: actions/download-artifact@v3
with:
path: ./
- name: Prepare artifacts
run: |
mkdir -p src/build/installers
mv ./repo/* ./src
mv ./amd64/build/installers/* ./src/build/installers/
mv ./arm64v8/* ./src/build/installers/
rm -rf ./repo
rm -rf ./amd64
rm -rf ./arm64v8
find ./ -type f -iname "*.sh" -exec chmod +x {} \;
find ./ -type f -iname "*.pl" -exec chmod +x {} \;
rm -rf ./src/build/installers/*.deb
rm -rf ./src/build/installers/*.pacman
rm -rf ./src/build/installers/*.rpm
rm -rf ./src/build/installers/*.AppImage
rm -rf ./src/build/installers/linux*
- name: Import SSH key
id: key
run: |
echo "Importing SSH ley..."
mkdir ~/.ssh
echo "${{ secrets.ID_RSA }}" | base64 -d > ~/.ssh/id_rsa
echo "Updating ~/.ssh/known_hosts..."
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
echo "Step completed"
- name: Checkout AUR repo
id: checkout
run: git clone ssh://aur@aur.archlinux.org/figma-linux.git ./aur
- name: Update PKGBUILD
id: pkgbuild
run: |
mkdir new-aur
cd ./src
docker build -t 4tqrgqe5yrgfd/figma-linux-docker-image-archlinux -f ./docker/archlinux .
docker cp $(docker create 4tqrgqe5yrgfd/figma-linux-docker-image-archlinux)://usr/src/figma-linux-aur/. ../new-aur
cp -rf ../new-aur/PKGBUILD ../aur/
cp -rf ../new-aur/.SRCINFO ../aur/
export version=$(cat build/installers/version)
echo ::set-output name=release::$version
- name: Push to AUR
id: push
run: |
git config --global --add user.name "${{ secrets.USER_NAME }}"
git config --global --add user.email "${{ secrets.EMAIL }}"
cd ./aur
git status
git add .
git commit -m "Release v${{ steps.pkgbuild.outputs.release }}"
git push origin master
flatpak:
name: Update Flatpak
runs-on: ubuntu-latest
needs: [release_amd64, release_arm64v8]
steps:
- uses: actions/download-artifact@v3
with:
path: ./
- name: Import SSH key
id: key
run: |
echo "Importing SSH ley..."
mkdir -p ~/.ssh
echo "${{ secrets.ID_RSA }}" | base64 -d > ~/.ssh/id_rsa
echo "Updating ~/.ssh/known_hosts..."
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
echo "Step completed"
- name: Clone repo
id: clone
run: |
git config --global --add user.name "${{ secrets.USER_NAME }}"
git config --global --add user.email "${{ secrets.EMAIL }}"
git clone git@github.com:Figma-Linux/io.github.Figma_Linux.figma_linux.git ./flatpak-repo
cd ./flatpak-repo
git remote add main git@github.com:flathub/io.github.Figma_Linux.figma_linux.git
git pull main master --no-ff
git push origin master
git push origin --delete bump-version || echo ''
- name: Update configs
id: update
run: |
sudo apt install libxml2-utils -y
mv ./amd64/* ./
mv ./arm64v8/* ./build/installers
rm -rf ./amd64
rm -rf ./arm64v8
find ./ -type f -iname "*.sh" -exec chmod +x {} \;
find ./ -type f -iname "*.pl" -exec chmod +x {} \;
cd ./repo
./scripts/generate_release_notes.pl --html
cd ..
data=$(cat ./repo/release_notes | tr -d '\n')
echo "First Print *appdata.xml file:"
cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml
cat ./repo/release_notes
prevVersion=$(cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml | grep -Eo 'release\sversion=".*"\s' | tr -d '[a-z=" \s\n]')
version="$(cat ./build/installers/version)"
echo "Bump version from $prevVersion to $version"
sed -i "s/$prevVersion/$version/g" ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml
sed -i "s/$prevVersion/$version/g" ./flatpak-repo/io.github.Figma_Linux.figma_linux.yml
echo "Updating sums..."
export sha256sums_x86_64="$(sha256sum ./build/installers/figma-linux_${version}_linux_amd64.deb | awk '{print $1}' | tr -d '\n')"
export sha256sums_aarch64="$(sha256sum ./build/installers/figma-linux_${version}_linux_arm64.deb | awk '{print $1}' | tr -d '\n')"
echo "sha256sums_x86_64: $sha256sums_x86_64"
echo "sha256sums_aarch64: $sha256sums_aarch64"
perl -pe 's{sha256:.*}{++$n == 1 ? "sha256: $ENV{'sha256sums_x86_64'}" : $&}ge' -i ./flatpak-repo/io.github.Figma_Linux.figma_linux.yml
perl -pe 's{sha256:.*}{++$n == 2 ? "sha256: $ENV{'sha256sums_aarch64'}" : $&}ge' -i ./flatpak-repo/io.github.Figma_Linux.figma_linux.yml
echo 'cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml after update sha sums'
cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml
cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml | tr -d '\n' > /tmp/tmp1
sed -i "s|<releases>|<releases><release version=\"$version\" date=\"$(date '+%Y-%m-%d')\"><description><ul>$data<\/ul><\/description><\/release>|g" /tmp/tmp1
echo "Print before formatting /tmp/tmp1 xml file:"
cat /tmp/tmp1
xmllint --format /tmp/tmp1 > ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml
echo "Print after formatting /tmp/tmp1 xml file:"
cat ./flatpak-repo/io.github.Figma_Linux.figma_linux.appdata.xml
echo ::set-output name=release::$version
- name: Push
id: push
run: |
git config --global --add user.name "${{ secrets.USER_NAME }}"
git config --global --add user.email "${{ secrets.EMAIL }}"
cd ./flatpak-repo
git checkout -b bump-version
git add .
git commit -m "Release v${{ steps.update.outputs.release }}"
git push origin bump-version
- name: Create Pull Request
run: |
curl -X POST -u "ChugunovRoman:${{ secrets.REPO_ACCESS_TOKEN }}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/flathub/io.github.Figma_Linux.figma_linux/pulls -d '{"title": "Release v${{ steps.update.outputs.release }} version","head":"Figma-Linux:bump-version","base":"master"}'