New Translations from Crowdin (by GitHub Action) (#92) #78
Workflow file for this run
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
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
workflow_dispatch: | |
name: Build Release | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build | |
run: | | |
sudo apt update | |
sudo apt install debhelper | |
./build.sh | |
- name: Copy artifacts | |
run: mkdir package && cp ../linuxmuster-linbo-gui7_* ./package | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: deb-package | |
path: package/* | |
github-release: | |
needs: build | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
name: GitHub Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: deb-package | |
- name: Extract current changes | |
run: cat *.changes | sed '0,/^Changes:$/d' | sed '/Checksums.*/Q' | sed '1,2d' | tail >> ./current-changes | |
- name: Define distribution variable | |
run: | | |
export DISTRIBUTION=$(grep -i ^Distribution *.changes | awk -F\: '{ print $2 }' | awk '{ print $1 }') | |
echo "DISTRIBUTION=$DISTRIBUTION" >> $GITHUB_ENV | |
export VERSION=$(grep -i ^Version *.changes | awk -F\: '{ print $2 }' | awk '{ print $1 }') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Test if it's a testing prerelease | |
id: check_prerelease | |
uses: haya14busa/action-cond@v1 | |
with: | |
cond: ${{ env.DISTRIBUTION == 'lmn71' }} | |
if_true: "false" | |
if_false: "true" | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ env.VERSION }} (${{ env.DISTRIBUTION }}) | |
draft: false | |
prerelease: ${{ steps.check_prerelease.outputs.value }} | |
body_path: ./current-changes | |
- name: Delete current changes file | |
run: rm ./current-changes | |
- name: Upload Release Assets | |
id: upload-release-assets | |
uses: dwenegar/upload-release-assets@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} | |
assets_path: . | |
publsh: | |
needs: build | |
name: Push to archive repo | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup SSH Key | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.REPO_SSH_KEY }}" | |
- name: Clone archive repo | |
uses: actions/checkout@v2 | |
with: | |
repository: "linuxmuster/archive" | |
ssh-key: ${{ secrets.REPO_SSH_KEY }} | |
path: "./archive" | |
- name: Prepare download | |
run: mkdir "package" | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: deb-package | |
path: "./package" | |
- name: Prepare environment | |
run: | | |
export PACKAGE=$(grep -i ^Source package/*.changes | awk -F\: '{ print $2 }' | awk '{ print $1 }') | |
echo "PACKAGE=$PACKAGE" >> $GITHUB_ENV | |
export DISTRIBUTION=$(grep -i ^Distribution package/*.changes | awk -F\: '{ print $2 }' | awk '{ print $1 }') | |
echo "DISTRIBUTION=$DISTRIBUTION" >> $GITHUB_ENV | |
export VERSION=$(grep -i ^Version package/*.changes | awk -F\: '{ print $2 }' | awk '{ print $1 }') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Copy packages | |
run: | | |
mkdir -p archive/packages/$PACKAGE/$DISTRIBUTION | |
rm -rf archive/packages/$PACKAGE/$DISTRIBUTION/* | |
cp package/* archive/packages/$PACKAGE/$DISTRIBUTION | |
- name: Push to repo | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
cd archive | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git checkout -b update/$PACKAGE-$DISTRIBUTION-$VERSION | |
git add * | |
git commit -a -m "Update $PACKAGE/$DISTRIBUTION to $VERSION (By GitHub actions)" | |
git push --set-upstream origin update/$PACKAGE-$DISTRIBUTION-$VERSION |