Prepare v7.3.1-rc1: improve setup UX and update CI #2
Workflow file for this run
This file contains hidden or 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: | |
| deb-package: | |
| name: build DEB-Package | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: sudo apt update && sudo apt install debhelper build-essential -y | |
| - name: Build | |
| run: make deb | |
| - name: Copy artifacts | |
| run: mkdir package && cp ../linuxmuster-fileserver_* ./package | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deb-package | |
| path: package/* | |
| github-release: | |
| needs: deb-package | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| name: GitHub Release | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| 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 variables | |
| 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 | |
| # Check if this is a prerelease (tag contains rc, beta, alpha, or pre) | |
| if echo "${{ github.ref_name }}" | grep -qiE '(rc|beta|alpha|pre)'; then | |
| echo "PRERELEASE=true" >> $GITHUB_ENV | |
| else | |
| echo "PRERELEASE=false" >> $GITHUB_ENV | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ github.ref }} | |
| name: Release ${{ env.VERSION }} (${{ env.DISTRIBUTION }}) | |
| draft: false | |
| prerelease: ${{ env.PRERELEASE == 'true' }} | |
| body_path: ./current-changes | |
| files: | | |
| *.deb | |
| *.changes | |
| *.buildinfo | |
| publish: | |
| needs: deb-package | |
| name: Push latest release to archive repo | |
| if: >- | |
| github.event_name == 'push' | |
| && contains(github.ref, 'refs/tags/') | |
| && !contains(github.ref, 'rc') | |
| && !contains(github.ref, 'beta') | |
| && !contains(github.ref, 'alpha') | |
| && !contains(github.ref, 'pre') | |
| && github.repository == 'linuxmuster/linuxmuster-fileserver' | |
| 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@v4 | |
| with: | |
| repository: "linuxmuster/deb" | |
| ssh-key: ${{ secrets.REPO_SSH_KEY }} | |
| path: "./deb" | |
| - name: Prepare download | |
| run: mkdir "package" | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| 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 | |
| export BRANCH_NAME=$(echo "$PACKAGE-$DISTRIBUTION-$VERSION" | sed 's/~/tilde/') | |
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
| - name: Copy packages | |
| run: | | |
| mkdir -p deb/packages/$PACKAGE/$DISTRIBUTION | |
| rm -rf deb/packages/$PACKAGE/$DISTRIBUTION/* | |
| cp package/* deb/packages/$PACKAGE/$DISTRIBUTION | |
| - name: Push to repo | |
| env: | |
| SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
| run: | | |
| cd deb | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git checkout -b update/$BRANCH_NAME | |
| git add * | |
| git commit -a -m "Update $PACKAGE/$DISTRIBUTION to $VERSION (By GitHub actions)" | |
| git push --set-upstream origin update/$BRANCH_NAME |