From 614d64b37319c0507f9fd27348d036c1a8b615ac Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 02:35:51 +0100 Subject: [PATCH 01/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 151 ++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 .github/workflows/Release.yml diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 000000000..eb5a298a1 --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,151 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + type: string + description: New version number in X.Y.Z + required: true + +jobs: + push-version-number: + runs-on: ubuntu-latest + steps: + - name: Clone develop repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT }} + ref: 'develop' + + - name: Get current version + id: current-version + shell: bash + run: | + version=$(cat ./src/version) + echo "version=${version}" >> $GITHUB_OUTPUT + + - name: Debug output current version + run: echo ${{ steps.current-version.outputs.version }} + +# - name: Push version number +# if: steps.package-version.outputs.current-version != github.event.inputs.version +# shell: bash +# run: | +# npm version --no-git-tag-version ${{ github.event.inputs.version }} +# +# - name: git add & commit & push +# if: steps.package-version.outputs.current-version != github.event.inputs.version +# uses: EndBug/add-and-commit@v9 +# with: +# add: 'package.json package-lock.json' +# default_author: github_actions +# message: 'chore: push version number to v${{ github.event.inputs.version }}' +# push: true + +# update-master-branch: +# needs: ['push-version-number'] +# runs-on: ubuntu-latest +# steps: +# - uses: everlytic/branch-merge@1.1.5 +# with: +# github_token: ${{ secrets.PAT }} +# source_ref: 'develop' +# target_branch: 'master' +# commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' +# +# release: +# needs: ['update-master-branch'] +# runs-on: ubuntu-latest +# steps: +# - name: Fetch repo +# uses: actions/checkout@v3 +# with: +# ref: 'master' +# fetch-depth: 0 +# +# - name: Install node +# uses: actions/setup-node@v3 +# with: +# node-version: 18 +# +# - name: Install dependencies +# run: npm ci +# +# - name: Build +# run: npm run build +# +# - name: Move build out of dist +# shell: bash +# run: mv ./dist/mainsail.zip ./mainsail.zip +# +# - name: Get latest tag +# id: latest_tag +# shell: bash +# run: | +# echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT +# +# - name: Generate a changelog +# uses: orhun/git-cliff-action@v1 +# id: generate-changelog +# with: +# config: ./cliff-release.toml +# args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD +# +# - name: Create release and upload build +# uses: softprops/action-gh-release@v1 +# id: create-release +# with: +# name: v${{ github.event.inputs.version }} +# tag_name: v${{ github.event.inputs.version }} +# token: ${{ secrets.GITHUB_TOKEN }} +# files: ./mainsail.zip +# body: ${{ steps.generate-changelog.outputs.content }} +# +# - name: Copy remote configs to dist +# shell: bash +# run: cp ./remote/* ./dist/ +# +# - name: Upload to remote server +# uses: SamKirkland/FTP-Deploy-Action@4.3.3 +# with: +# server: ${{ secrets.REMOTEHOST }} +# username: ${{ secrets.REMOTEUSER }} +# password: ${{ secrets.REMOTEPASSWORD }} +# dangerous-clean-slate: true +# local-dir: ./dist/ +# +# update-changelog: +# needs: ['release'] +# name: Generate changelog +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# with: +# ref: 'develop' +# token: ${{ secrets.PAT }} +# fetch-depth: 0 +# +# - name: Get latest tag +# id: latest_tag +# shell: bash +# run: | +# echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT +# +# - name: Generate a changelog +# uses: orhun/git-cliff-action@v1 +# id: git-cliff +# with: +# config: cliff.toml +# args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }} +# env: +# OUTPUT: ${{ github.workspace }}/CHANGELOG.md +# +# - name: Show CHANGELOG +# run: | +# cat CHANGELOG.md +# - uses: stefanzweifel/git-auto-commit-action@v4 +# with: +# commit_message: 'docs(changelog): update changelog' +# file_pattern: CHANGELOG.md From fea8e8337057b4d1907148861200d42b83eb3ca0 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 02:42:41 +0100 Subject: [PATCH 02/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index eb5a298a1..cb6ca5462 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -28,11 +28,17 @@ jobs: - name: Debug output current version run: echo ${{ steps.current-version.outputs.version }} -# - name: Push version number -# if: steps.package-version.outputs.current-version != github.event.inputs.version -# shell: bash -# run: | -# npm version --no-git-tag-version ${{ github.event.inputs.version }} + - name: Push version number + if: steps.current-version.outputs.version != github.event.inputs.version + shell: bash + run: | + echo ${{ steps.current-version.outputs.version }} >> ./src/version + + - name: Debug output current version output + if: steps.current-version.outputs.version != github.event.inputs.version + run: cat ./src/version + + # # - name: git add & commit & push # if: steps.package-version.outputs.current-version != github.event.inputs.version From cc7590995ddac101241084e42984a6c43456cb98 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 02:44:12 +0100 Subject: [PATCH 03/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index cb6ca5462..0fd4e61ce 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -32,7 +32,7 @@ jobs: if: steps.current-version.outputs.version != github.event.inputs.version shell: bash run: | - echo ${{ steps.current-version.outputs.version }} >> ./src/version + echo ${{ github.event.inputs.version }} > ./src/version - name: Debug output current version output if: steps.current-version.outputs.version != github.event.inputs.version From af061f3511861c6905eeb7cb91ccd2ed24d8938a Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 02:46:37 +0100 Subject: [PATCH 04/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 38 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 0fd4e61ce..61908eb94 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -38,27 +38,25 @@ jobs: if: steps.current-version.outputs.version != github.event.inputs.version run: cat ./src/version + - name: git add & commit & push + if: steps.current-version.outputs.version != github.event.inputs.version + uses: EndBug/add-and-commit@v9 + with: + add: './src/version' + default_author: github_actions + message: 'chore: push version number to v${{ github.event.inputs.version }}' + push: true -# -# - name: git add & commit & push -# if: steps.package-version.outputs.current-version != github.event.inputs.version -# uses: EndBug/add-and-commit@v9 -# with: -# add: 'package.json package-lock.json' -# default_author: github_actions -# message: 'chore: push version number to v${{ github.event.inputs.version }}' -# push: true - -# update-master-branch: -# needs: ['push-version-number'] -# runs-on: ubuntu-latest -# steps: -# - uses: everlytic/branch-merge@1.1.5 -# with: -# github_token: ${{ secrets.PAT }} -# source_ref: 'develop' -# target_branch: 'master' -# commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' + update-master-branch: + needs: ['push-version-number'] + runs-on: ubuntu-latest + steps: + - uses: everlytic/branch-merge@1.1.5 + with: + github_token: ${{ secrets.PAT }} + source_ref: 'develop' + target_branch: 'master' + commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' # # release: # needs: ['update-master-branch'] From eecb3fa52d4e40351d1c2d3f171a9f9aa6bba1db Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:02:48 +0100 Subject: [PATCH 05/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 45 ++++++++++++++++++++---- cliff-release.toml | 65 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 cliff-release.toml diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 61908eb94..48e712770 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -25,19 +25,12 @@ jobs: version=$(cat ./src/version) echo "version=${version}" >> $GITHUB_OUTPUT - - name: Debug output current version - run: echo ${{ steps.current-version.outputs.version }} - - name: Push version number if: steps.current-version.outputs.version != github.event.inputs.version shell: bash run: | echo ${{ github.event.inputs.version }} > ./src/version - - name: Debug output current version output - if: steps.current-version.outputs.version != github.event.inputs.version - run: cat ./src/version - - name: git add & commit & push if: steps.current-version.outputs.version != github.event.inputs.version uses: EndBug/add-and-commit@v9 @@ -57,6 +50,44 @@ jobs: source_ref: 'develop' target_branch: 'master' commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}' + + release: + name: Create Release + needs: ['update-master-branch'] + runs-on: ubuntu-latest + outputs: + id: ${{ steps.create-release.outputs.id }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: 'develop' + + - name: Get latest tag + id: latest_tag + shell: bash + run: | + echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + + - name: Generate a changelog + uses: orhun/git-cliff-action@v1 + id: changelog + with: + config: ./cliff-release.toml + args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD + + - name: Create empty release + id: create-release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: 'MainsailOS ${{ github.event.inputs.version }}' + tag_name: ${{ github.event.inputs.version }} + body: ${{ steps.changelog.outputs.content }} + draft: true + + + # # release: # needs: ['update-master-branch'] diff --git a/cliff-release.toml b/cliff-release.toml new file mode 100644 index 000000000..04c350395 --- /dev/null +++ b/cliff-release.toml @@ -0,0 +1,65 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# What's Changed +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% for group, commits in commits | group_by(attribute="group") %}\ + ### {{ group | split(pat="$") | last | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + + {%- endfor -%} + {%- for commit in commits %} + {%- if commit.scope -%} + {% else -%} + {% raw %}\n{% endraw %}\ + - {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + + {% endif -%} + {% endfor -%} + {% raw %}\n{% endraw %} +{% endfor %}\n\ +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ +""" + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +filter_unconventional = true +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits + { message = "^feat(\\(.*\\))?:", group = "1$Features"}, + { message = "^feature(\\(.*\\))?:", group = "1$Features"}, + { message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"}, + { message = "^docs(\\(.*\\))?:", group = "7$Documentation"}, + { message = "^refactor(\\(.*\\))?:", group = "4$Refactor"}, + { message = "^style(\\(.*\\))?:", group = "5$Styling"}, + { message = "^test(\\(.*\\))?:", group = "9$Other"}, + { message = "^chore(\\(.*\\))?:", group = "9$Other"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = true +ignore_tags="v*-(beta|rc)*" +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" From 25e1ca6bf4b35542eab72bd2b53f77a1d5ca2ae6 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:07:58 +0100 Subject: [PATCH 06/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 48e712770..2d076f562 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -10,6 +10,7 @@ on: jobs: push-version-number: + name: Push version number runs-on: ubuntu-latest steps: - name: Clone develop repository @@ -41,6 +42,7 @@ jobs: push: true update-master-branch: + name: Update master branch needs: ['push-version-number'] runs-on: ubuntu-latest steps: From 135f18c999b496edd4445720c482cfe31a458b98 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:13:59 +0100 Subject: [PATCH 07/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 60 +++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 2d076f562..70c4af3a1 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -43,7 +43,7 @@ jobs: update-master-branch: name: Update master branch - needs: ['push-version-number'] + needs: push-version-number runs-on: ubuntu-latest steps: - uses: everlytic/branch-merge@1.1.5 @@ -55,7 +55,7 @@ jobs: release: name: Create Release - needs: ['update-master-branch'] + needs: update-master-branch runs-on: ubuntu-latest outputs: id: ${{ steps.create-release.outputs.id }} @@ -78,6 +78,9 @@ jobs: config: ./cliff-release.toml args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD + - name: Debug output changelog + run: echo ${{ steps.changelog.outputs.content }} + - name: Create empty release id: create-release uses: softprops/action-gh-release@v1 @@ -88,7 +91,60 @@ jobs: body: ${{ steps.changelog.outputs.content }} draft: true + matrix: + name: Create Matrix + needs: release + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: master + + - name: Create Matrix + id: set-matrix + run: | + ARRAY=$(find ${{ github.workspace }}/config -type f -printf '%P\n' | sed '/default/d' | sort | jq -R -s -c 'split("\n")[:-1]') + echo "matrix=${ARRAY}" >> $GITHUB_OUTPUT + + build: + needs: matrix + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: ${{ fromJson(needs.matrix.outputs.matrix) }} + steps: + - name: Build image + id: build + uses: mainsail-crew/MainsailOS-actions/dummy-image@master + with: + config: ${{ matrix.config }} + + - name: Copy output + id: copy-image + if: always() + shell: bash + run: | + source repository/src/config + NOW="$(date +"%Y-%m-%d")" + IMAGE="${NOW}-${DIST_NAME}-${DIST_VERSION}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" + + cp repository/src/workspace/*.img $IMAGE.img + + echo "image=${IMAGE}" >> $GITHUB_OUTPUT + + - name: Upload failed Logfile + if: failure() + uses: actions/upload-artifact@v3 + with: + name: failed-${{ steps.copy-image.outputs.image }}.log + path: repository/src/build.log + - name: Debug output + run: echo ${{ steps.copy-image.outputs.image }} # # release: From ab6e1fad280d824ccba7474c5f6d7d9881c9d66b Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:28:24 +0100 Subject: [PATCH 08/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 70c4af3a1..9c3cf41a2 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -63,7 +63,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - ref: 'develop' + ref: 'master' - name: Get latest tag id: latest_tag From 75c06370e69d595d9d3ce389670923455f80a4a5 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:30:24 +0100 Subject: [PATCH 09/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9c3cf41a2..c978a4859 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -76,7 +76,7 @@ jobs: id: changelog with: config: ./cliff-release.toml - args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD + args: -u - name: Debug output changelog run: echo ${{ steps.changelog.outputs.content }} From dd0528586ca4cc34a3fd31a1ba45a98ce94b3f24 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:32:57 +0100 Subject: [PATCH 10/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index c978a4859..9c3cf41a2 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -76,7 +76,7 @@ jobs: id: changelog with: config: ./cliff-release.toml - args: -u + args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD - name: Debug output changelog run: echo ${{ steps.changelog.outputs.content }} From baa9274694e52cc2e8606e4bc5d69ab15f9a47a4 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 03:50:01 +0100 Subject: [PATCH 11/40] chore: add cliff-release.toml Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9c3cf41a2..0d6fb8254 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -146,6 +146,45 @@ jobs: - name: Debug output run: echo ${{ steps.copy-image.outputs.image }} + - name: Compressing Image + shell: bash + run: | + CPU_COUNT="$(nproc)" + echo -e "\e[32mUsing ${CPU_COUNT} Cores for compression...\e[0m" + xz -efkvz9T"${CPU_COUNT}" ${{ steps.copy-image.outputs.image }}.img + + - name: Calculating checksums + id: checksums + shell: bash + run: | + sha256sum ${{ steps.copy-image.outputs.image }}.img > ${{ steps.copy-image.outputs.image }}.img.sha256 + image_checksum=`cat ${{ steps.copy-image.outputs.image }}.img.sha256 | awk '{ print $1 }'` + echo "image=${image_checksum}" >> $GITHUB_OUTPUT + + sha256sum ${{ steps.copy-image.outputs.image }}.img.xz > ${{ steps.copy-image.outputs.image }}.img.xz.sha256 + zip_checksum=`cat ${{ steps.copy-image.outputs.image }}.img.xz.sha256 | awk '{ print $1 }'` + echo "zip=${zip_checksum}" >> $GITHUB_OUTPUT + + - name: Calculating filesizes + id: filesizes + shell: bash + run: | + image_filesize=`wc -c ${{ steps.copy-image.outputs.image }}.img | awk '{print $1}'` + echo "image=${image_filesize}" >> $GITHUB_OUTPUT + + zip_filesize=`wc -c ${{ steps.copy-image.outputs.image }}.img.xz | awk '{print $1}'` + echo "zip=${zip_filesize}" >> $GITHUB_OUTPUT + + - name: Debug output + run: | + echo ${{ steps.copy-image.outputs.image }} + + echo ${{ steps.checksums.outputs.image }} + echo ${{ steps.checksums.outputs.zip }} + + echo ${{ steps.filesizes.outputs.image }} + echo ${{ steps.filesizes.outputs.zip }} + # # release: # needs: ['update-master-branch'] From 13429cf481b0f16f9896c4009e5b7a1f71d54734 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 04:43:10 +0100 Subject: [PATCH 12/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 0d6fb8254..a7a63f363 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -135,6 +135,7 @@ jobs: cp repository/src/workspace/*.img $IMAGE.img echo "image=${IMAGE}" >> $GITHUB_OUTPUT + echo "date=${NOW}" >> $GITHUB_OUTPUT - name: Upload failed Logfile if: failure() @@ -185,6 +186,40 @@ jobs: echo ${{ steps.filesizes.outputs.image }} echo ${{ steps.filesizes.outputs.zip }} + - name: Generate JSON + id: json + uses: actions/github-script@v6 + env: + name: 'Mainsail OS ${{ github.event.inputs.version }}' + description: 'Type: ${{ steps.build.outputs.type }}, SBC: ${{ steps.build.outputs.sbc }}' + url: 'https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz' + icon: 'https://os.mainsail.xyz/rpi-imager.png' + init_format: 'systemd' + release_date: ${{ steps.copy-image.outputs.image }} + extract_size: ${{ steps.filesizes.outputs.date }} + extract_sha256: ${{ steps.checksums.outputs.image }} + image_download_size: ${{ steps.filesizes.outputs.zip }} + image_download_sha256: ${{ steps.checksums.outputs.zip }} + with: + result-encoding: string + script: | + const { name, description, url, icon, init_format, release_date, extract_size, extract_sha256, image_download_size, image_download_sha256 } = process.env + + return JSON.stringify({ + name, + description, + url, + icon, + init_format, + release_date, + extract_size, + extract_sha256, + image_download_size, + image_download_sha256 + }) + + + # # release: # needs: ['update-master-branch'] From 205610894a0b4b03bf856c723c24fc8e164c05c5 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 04:57:31 +0100 Subject: [PATCH 13/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index a7a63f363..985a38be5 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -195,8 +195,8 @@ jobs: url: 'https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz' icon: 'https://os.mainsail.xyz/rpi-imager.png' init_format: 'systemd' - release_date: ${{ steps.copy-image.outputs.image }} - extract_size: ${{ steps.filesizes.outputs.date }} + release_date: ${{ steps.copy-image.outputs.date }} + extract_size: ${{ steps.filesizes.outputs.image }} extract_sha256: ${{ steps.checksums.outputs.image }} image_download_size: ${{ steps.filesizes.outputs.zip }} image_download_sha256: ${{ steps.checksums.outputs.zip }} @@ -217,6 +217,8 @@ jobs: image_download_size, image_download_sha256 }) + - name: Get result + run: echo "${{steps.json.outputs.result}}" From 8832dc584dcffe123c61703c719a2ce52b6b4e0c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 05:13:48 +0100 Subject: [PATCH 14/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 985a38be5..402ecb626 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -137,6 +137,15 @@ jobs: echo "image=${IMAGE}" >> $GITHUB_OUTPUT echo "date=${NOW}" >> $GITHUB_OUTPUT + - name: Upload Image + if: success() + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.release.id }} + file: ${{ steps.copy-image.outputs.image }}.img + - name: Upload failed Logfile if: failure() uses: actions/upload-artifact@v3 @@ -154,6 +163,15 @@ jobs: echo -e "\e[32mUsing ${CPU_COUNT} Cores for compression...\e[0m" xz -efkvz9T"${CPU_COUNT}" ${{ steps.copy-image.outputs.image }}.img + - name: Upload Compressing Image + if: success() + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.release.id }} + file: ${{ steps.copy-image.outputs.image }}.img.xz + - name: Calculating checksums id: checksums shell: bash @@ -166,6 +184,15 @@ jobs: zip_checksum=`cat ${{ steps.copy-image.outputs.image }}.img.xz.sha256 | awk '{ print $1 }'` echo "zip=${zip_checksum}" >> $GITHUB_OUTPUT + - name: Upload Checksums + if: success() + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.release.id }} + file: ${{ steps.copy-image.outputs.image }}.img.sha256;${{ steps.copy-image.outputs.image }}.img.xz.sha256 + - name: Calculating filesizes id: filesizes shell: bash @@ -217,9 +244,30 @@ jobs: image_download_size, image_download_sha256 }) - - name: Get result - run: echo "${{steps.json.outputs.result}}" + - name: Write JSON + run: echo "${{steps.json.outputs.result}}" > "./${{ steps.copy-image.outputs.image }}.json" + + - name: Upload JSON + if: success() + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.release.id }} + file: ${{ steps.copy-image.outputs.image }}.json + + finish: + name: Finish Release + needs: [ release, build ] + runs-on: ubuntu-latest + steps: + - name: Publish Release + uses: StuYarrow/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + id: ${{ needs.release.outputs.id }} # From a20738dc4d931e0f1e585049d4ab5b259fe12da2 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 05:21:57 +0100 Subject: [PATCH 15/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 402ecb626..0c1bed09a 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -144,7 +144,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: release_id: ${{ needs.release.id }} - file: ${{ steps.copy-image.outputs.image }}.img + file: ${{ github.workspace }}/${{ steps.copy-image.outputs.image }}.img - name: Upload failed Logfile if: failure() From ce70aabe11333657a9e08741689300a2588ad398 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 12:34:42 +0100 Subject: [PATCH 16/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 0c1bed09a..22030c3cd 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -143,7 +143,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ needs.release.id }} + release_id: ${{ needs.release.outputs.id }} file: ${{ github.workspace }}/${{ steps.copy-image.outputs.image }}.img - name: Upload failed Logfile @@ -169,7 +169,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ needs.release.id }} + release_id: ${{ needs.release.outputs.id }} file: ${{ steps.copy-image.outputs.image }}.img.xz - name: Calculating checksums @@ -190,7 +190,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ needs.release.id }} + release_id: ${{ needs.release.outputs.id }} file: ${{ steps.copy-image.outputs.image }}.img.sha256;${{ steps.copy-image.outputs.image }}.img.xz.sha256 - name: Calculating filesizes @@ -254,7 +254,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - release_id: ${{ needs.release.id }} + release_id: ${{ needs.release.outputs.id }} file: ${{ steps.copy-image.outputs.image }}.json finish: From 173d5246cc0609f9817bf297a3d1ac8831bd2cca Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 13:01:25 +0100 Subject: [PATCH 17/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 22030c3cd..460fd0133 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -205,6 +205,8 @@ jobs: - name: Debug output run: | + echo ${{ needs.release.outputs.id }} + echo ${{ steps.copy-image.outputs.image }} echo ${{ steps.checksums.outputs.image }} From 096c51d4ac4c5aa778a82ac53df0c191ed2c1ccd Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 13:27:29 +0100 Subject: [PATCH 18/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 460fd0133..10c1ff5cc 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -91,6 +91,9 @@ jobs: body: ${{ steps.changelog.outputs.content }} draft: true + - name: Debug output + run: echo ${{ steps.create-release.outputs.id }} + matrix: name: Create Matrix needs: release From c94e1938a14a32ba8b307ef62742a426ed56585e Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 13:33:20 +0100 Subject: [PATCH 19/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 10c1ff5cc..9ee792f8c 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -94,6 +94,13 @@ jobs: - name: Debug output run: echo ${{ steps.create-release.outputs.id }} + - name: emit version + id: emit-version + shell: bash + run: | + version=${{ steps.create-release.outputs.id }} + echo "version=${version}" >> $GITHUB_OUTPUT + matrix: name: Create Matrix needs: release @@ -209,6 +216,7 @@ jobs: - name: Debug output run: | echo ${{ needs.release.outputs.id }} + echo ${{ needs.release.outputs.version }} echo ${{ steps.copy-image.outputs.image }} From 0c5630ed02366574aaaa74b595a8f6aec00213c0 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 13:37:09 +0100 Subject: [PATCH 20/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9ee792f8c..4227a9c53 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -120,7 +120,7 @@ jobs: echo "matrix=${ARRAY}" >> $GITHUB_OUTPUT build: - needs: matrix + needs: [ release, matrix ] runs-on: ubuntu-latest strategy: fail-fast: false From 5b70afba104b843d167f849aa301a5900f918465 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 14:39:06 +0100 Subject: [PATCH 21/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 4227a9c53..9a2399c39 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -132,6 +132,7 @@ jobs: uses: mainsail-crew/MainsailOS-actions/dummy-image@master with: config: ${{ matrix.config }} + build-ref: master - name: Copy output id: copy-image From 73eeba76915e9ad600ff49253caf7d62c24dd33c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 14:50:57 +0100 Subject: [PATCH 22/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/BuildImages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/BuildImages.yml b/.github/workflows/BuildImages.yml index 63199d2aa..e95ea52bb 100644 --- a/.github/workflows/BuildImages.yml +++ b/.github/workflows/BuildImages.yml @@ -5,6 +5,7 @@ on: - "master" - "develop" paths: + - "!src/version" - "src/**" - "config/**" - ".github/workflows/BuildImages.yml" From 57cbd1ee80c5d0f7c0cf5791c60ae42dae9338b8 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 15:16:27 +0100 Subject: [PATCH 23/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/BuildImages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/BuildImages.yml b/.github/workflows/BuildImages.yml index e95ea52bb..43312a994 100644 --- a/.github/workflows/BuildImages.yml +++ b/.github/workflows/BuildImages.yml @@ -5,8 +5,8 @@ on: - "master" - "develop" paths: - - "!src/version" - - "src/**" + - "src/modules/**" + - "src/build_dist" - "config/**" - ".github/workflows/BuildImages.yml" tags-ignore: From 1ee4f9b061c41ba287571561cfe1023f16424181 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:04:50 +0100 Subject: [PATCH 24/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 41 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9a2399c39..7bd3f6c89 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -59,6 +59,8 @@ jobs: runs-on: ubuntu-latest outputs: id: ${{ steps.create-release.outputs.id }} + date: ${{ steps.base-name.outputs.date }} + base_name: ${{ steps.base-name.outputs.output }} steps: - name: Checkout uses: actions/checkout@v3 @@ -78,9 +80,6 @@ jobs: config: ./cliff-release.toml args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD - - name: Debug output changelog - run: echo ${{ steps.changelog.outputs.content }} - - name: Create empty release id: create-release uses: softprops/action-gh-release@v1 @@ -91,15 +90,17 @@ jobs: body: ${{ steps.changelog.outputs.content }} draft: true - - name: Debug output - run: echo ${{ steps.create-release.outputs.id }} - - - name: emit version - id: emit-version + - name: Create Base Name + id: base-name + if: always() shell: bash run: | - version=${{ steps.create-release.outputs.id }} - echo "version=${version}" >> $GITHUB_OUTPUT + source src/config + NOW="$(date +"%Y-%m-%d")" + output="${NOW}-${DIST_NAME}-${DIST_VERSION}-" + + echo "output=${output}" >> $GITHUB_OUTPUT + echo "date=${NOW}" >> $GITHUB_OUTPUT matrix: name: Create Matrix @@ -139,14 +140,10 @@ jobs: if: always() shell: bash run: | - source repository/src/config - NOW="$(date +"%Y-%m-%d")" - IMAGE="${NOW}-${DIST_NAME}-${DIST_VERSION}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" - + IMAGE="${ needs.release.outputs.base_name }${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" cp repository/src/workspace/*.img $IMAGE.img echo "image=${IMAGE}" >> $GITHUB_OUTPUT - echo "date=${NOW}" >> $GITHUB_OUTPUT - name: Upload Image if: success() @@ -236,7 +233,7 @@ jobs: url: 'https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz' icon: 'https://os.mainsail.xyz/rpi-imager.png' init_format: 'systemd' - release_date: ${{ steps.copy-image.outputs.date }} + release_date: ${{ needs.release.outputs.date }} extract_size: ${{ steps.filesizes.outputs.image }} extract_sha256: ${{ steps.checksums.outputs.image }} image_download_size: ${{ steps.filesizes.outputs.zip }} @@ -283,6 +280,18 @@ jobs: with: id: ${{ needs.release.outputs.id }} + update-rpi-imager: + name: Update rpi-imager json + needs: [ release, finish ] + runs-on: ubuntu-latest + steps: + - name: Download snipes + uses: robinraju/release-downloader@v1.6 + with: + releaseId: ${{ needs.release.outputs.id }} + fileName: "${{ needs.release.outputs.base_name }}-raspberry-*.json" + + # # release: From ef672cef64bfdc98c18dfa08715bef7b343bb584 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:09:41 +0100 Subject: [PATCH 25/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 7bd3f6c89..19661ea27 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -95,7 +95,7 @@ jobs: if: always() shell: bash run: | - source src/config + source ./src/config NOW="$(date +"%Y-%m-%d")" output="${NOW}-${DIST_NAME}-${DIST_VERSION}-" From 94bbafc8bd213e00e876a0ceaa5d25b0b171446d Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:11:39 +0100 Subject: [PATCH 26/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 19661ea27..4c1c3d4d6 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -95,7 +95,7 @@ jobs: if: always() shell: bash run: | - source ./src/config + source ${{ github.workspace }}/src/config NOW="$(date +"%Y-%m-%d")" output="${NOW}-${DIST_NAME}-${DIST_VERSION}-" From 7241069e8e2bb7e98e52daf17817a7221fe4005b Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:15:45 +0100 Subject: [PATCH 27/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 4c1c3d4d6..d4ff2b424 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -95,7 +95,7 @@ jobs: if: always() shell: bash run: | - source ${{ github.workspace }}/src/config + source config/default NOW="$(date +"%Y-%m-%d")" output="${NOW}-${DIST_NAME}-${DIST_VERSION}-" From d2159a7d22cca6942f158844310fb75f0dfdd2d9 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:25:27 +0100 Subject: [PATCH 28/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index d4ff2b424..8d8c2f84e 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -60,7 +60,6 @@ jobs: outputs: id: ${{ steps.create-release.outputs.id }} date: ${{ steps.base-name.outputs.date }} - base_name: ${{ steps.base-name.outputs.output }} steps: - name: Checkout uses: actions/checkout@v3 @@ -90,16 +89,12 @@ jobs: body: ${{ steps.changelog.outputs.content }} draft: true - - name: Create Base Name + - name: Create Date id: base-name if: always() shell: bash run: | - source config/default NOW="$(date +"%Y-%m-%d")" - output="${NOW}-${DIST_NAME}-${DIST_VERSION}-" - - echo "output=${output}" >> $GITHUB_OUTPUT echo "date=${NOW}" >> $GITHUB_OUTPUT matrix: @@ -123,6 +118,8 @@ jobs: build: needs: [ release, matrix ] runs-on: ubuntu-latest + outputs: + base_name: ${{ steps.copy-image.outputs.base_name }} strategy: fail-fast: false matrix: @@ -140,10 +137,13 @@ jobs: if: always() shell: bash run: | - IMAGE="${ needs.release.outputs.base_name }${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" - cp repository/src/workspace/*.img $IMAGE.img + output="${NOW}" + base_name="${ needs.release.outputs.date }-${DIST_NAME}-${DIST_VERSION} + image="${base_name}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" + cp repository/src/workspace/*.img $image.img - echo "image=${IMAGE}" >> $GITHUB_OUTPUT + echo "base_name=${base_name}" >> $GITHUB_OUTPUT + echo "image=${image}" >> $GITHUB_OUTPUT - name: Upload Image if: success() @@ -282,14 +282,14 @@ jobs: update-rpi-imager: name: Update rpi-imager json - needs: [ release, finish ] + needs: [ release, build, finish ] runs-on: ubuntu-latest steps: - name: Download snipes uses: robinraju/release-downloader@v1.6 with: releaseId: ${{ needs.release.outputs.id }} - fileName: "${{ needs.release.outputs.base_name }}-raspberry-*.json" + fileName: "${{ needs.build.outputs.base_name }}-raspberry-*.json" From 6f48b83fdc95ee7d78a1e1271b93d915d5745423 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:28:37 +0100 Subject: [PATCH 29/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 8d8c2f84e..9979da0c1 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -137,8 +137,7 @@ jobs: if: always() shell: bash run: | - output="${NOW}" - base_name="${ needs.release.outputs.date }-${DIST_NAME}-${DIST_VERSION} + base_name="${ needs.release.outputs.date }-${DIST_NAME}-${DIST_VERSION}" image="${base_name}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" cp repository/src/workspace/*.img $image.img From 43755501d1ae0fe8c89bd4625396172ddfad45eb Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 19:56:47 +0100 Subject: [PATCH 30/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9979da0c1..9f7404d27 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -137,7 +137,7 @@ jobs: if: always() shell: bash run: | - base_name="${ needs.release.outputs.date }-${DIST_NAME}-${DIST_VERSION}" + base_name="${{ needs.release.outputs.date }}-${DIST_NAME}-${DIST_VERSION}" image="${base_name}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" cp repository/src/workspace/*.img $image.img From 970eb6110a08784c27aa26895bfa188d5998debe Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 20:02:02 +0100 Subject: [PATCH 31/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 9f7404d27..907819308 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -137,6 +137,7 @@ jobs: if: always() shell: bash run: | + source repository/src/config base_name="${{ needs.release.outputs.date }}-${DIST_NAME}-${DIST_VERSION}" image="${base_name}-${{ steps.build.outputs.type }}-${{ steps.build.outputs.sbc }}" cp repository/src/workspace/*.img $image.img From befd46901c72787746241fa1e48577e6ad8b8729 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 20:03:43 +0100 Subject: [PATCH 32/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 907819308..41ceee2a8 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -288,9 +288,12 @@ jobs: - name: Download snipes uses: robinraju/release-downloader@v1.6 with: - releaseId: ${{ needs.release.outputs.id }} + tag: ${{ github.event.inputs.version }} fileName: "${{ needs.build.outputs.base_name }}-raspberry-*.json" + - name: Debug + run: ls ./* + # From 917356e65edc7ea94bd7921d872a989f3ca77e0a Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 22:39:10 +0100 Subject: [PATCH 33/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 91 +++++++++++++++-------------------- 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 41ceee2a8..17045a65e 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -290,64 +290,49 @@ jobs: with: tag: ${{ github.event.inputs.version }} fileName: "${{ needs.build.outputs.base_name }}-raspberry-*.json" + out-file-path: "downloads" - name: Debug - run: ls ./* + run: ls ./downloads/* + + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Run script + uses: jannekem/run-python-script-action@v1 + with: + script: | + import os, json, shutil + with open("rpi-imager.json", "r+") as t: + t.truncate(0) + t.write('[') + for filename in os.scandir('downloads'): + print(filename) + with open(filename, "r") as f: + content = f.read() + t.write(content) + t.write(',') + t.write(']') + barak = open("rpi-imager.json", "r+") + contentb = barak.read() + print(contentb) + + - name: Debug + run: cat rpi-imager.json + + - name: Upload JSON + if: success() + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ needs.release.outputs.id }} + file: rpi-imager.json -# -# release: -# needs: ['update-master-branch'] -# runs-on: ubuntu-latest -# steps: -# - name: Fetch repo -# uses: actions/checkout@v3 -# with: -# ref: 'master' -# fetch-depth: 0 -# -# - name: Install node -# uses: actions/setup-node@v3 -# with: -# node-version: 18 -# -# - name: Install dependencies -# run: npm ci -# -# - name: Build -# run: npm run build -# -# - name: Move build out of dist -# shell: bash -# run: mv ./dist/mainsail.zip ./mainsail.zip -# -# - name: Get latest tag -# id: latest_tag -# shell: bash -# run: | -# echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT -# -# - name: Generate a changelog -# uses: orhun/git-cliff-action@v1 -# id: generate-changelog -# with: -# config: ./cliff-release.toml -# args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD -# -# - name: Create release and upload build -# uses: softprops/action-gh-release@v1 -# id: create-release -# with: -# name: v${{ github.event.inputs.version }} -# tag_name: v${{ github.event.inputs.version }} -# token: ${{ secrets.GITHUB_TOKEN }} -# files: ./mainsail.zip -# body: ${{ steps.generate-changelog.outputs.content }} -# -# - name: Copy remote configs to dist -# shell: bash -# run: cp ./remote/* ./dist/ # # - name: Upload to remote server # uses: SamKirkland/FTP-Deploy-Action@4.3.3 From 6accbd86f2d66721aed365722a2e24a08a4e5d18 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 22:42:33 +0100 Subject: [PATCH 34/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 17045a65e..621878eb0 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -293,7 +293,9 @@ jobs: out-file-path: "downloads" - name: Debug - run: ls ./downloads/* + run: | + ls ./downloads/* + touch rpi-imager.json - name: setup python uses: actions/setup-python@v2 From ef0bcec7791a618847afe9b3fc0e78ba14370989 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 22:50:20 +0100 Subject: [PATCH 35/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 621878eb0..01db53977 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -228,16 +228,16 @@ jobs: id: json uses: actions/github-script@v6 env: - name: 'Mainsail OS ${{ github.event.inputs.version }}' - description: 'Type: ${{ steps.build.outputs.type }}, SBC: ${{ steps.build.outputs.sbc }}' - url: 'https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz' - icon: 'https://os.mainsail.xyz/rpi-imager.png' - init_format: 'systemd' + name: '"Mainsail OS ${{ github.event.inputs.version }}"' + description: '"Type: ${{ steps.build.outputs.type }}, SBC: ${{ steps.build.outputs.sbc }}"' + url: '"https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz"' + icon: '"https://os.mainsail.xyz/rpi-imager.png"' + init_format: '"systemd"' release_date: ${{ needs.release.outputs.date }} extract_size: ${{ steps.filesizes.outputs.image }} - extract_sha256: ${{ steps.checksums.outputs.image }} + extract_sha256: '"${{ steps.checksums.outputs.image }}"' image_download_size: ${{ steps.filesizes.outputs.zip }} - image_download_sha256: ${{ steps.checksums.outputs.zip }} + image_download_sha256: '"${{ steps.checksums.outputs.zip }}"' with: result-encoding: string script: | From ab3314ac4a423af95eac826ec9875b71ef93930b Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 23:05:45 +0100 Subject: [PATCH 36/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 01db53977..2dc2dfd9a 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -233,7 +233,7 @@ jobs: url: '"https://github.com/mainsail-crew/MainsailOS/releases/download/${{ github.event.inputs.version }}/${{ steps.copy-image.outputs.image }}.img.xz"' icon: '"https://os.mainsail.xyz/rpi-imager.png"' init_format: '"systemd"' - release_date: ${{ needs.release.outputs.date }} + release_date: '"${{ needs.release.outputs.date }}"' extract_size: ${{ steps.filesizes.outputs.image }} extract_sha256: '"${{ steps.checksums.outputs.image }}"' image_download_size: ${{ steps.filesizes.outputs.zip }} @@ -309,14 +309,14 @@ jobs: import os, json, shutil with open("rpi-imager.json", "r+") as t: t.truncate(0) - t.write('[') + t.write('{ "os_list": [') for filename in os.scandir('downloads'): print(filename) with open(filename, "r") as f: content = f.read() t.write(content) t.write(',') - t.write(']') + t.write('] }') barak = open("rpi-imager.json", "r+") contentb = barak.read() print(contentb) From 8bd88d84ad211db72ee103a3925a148671fcefd6 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 23:29:31 +0100 Subject: [PATCH 37/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 92 +++++++++++++++++------------------ cliff.toml | 74 ++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 47 deletions(-) create mode 100644 cliff.toml diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 2dc2dfd9a..c2f0396d4 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -321,9 +321,6 @@ jobs: contentb = barak.read() print(contentb) - - name: Debug - run: cat rpi-imager.json - - name: Upload JSON if: success() uses: xresloader/upload-to-github-release@v1 @@ -333,49 +330,50 @@ jobs: release_id: ${{ needs.release.outputs.id }} file: rpi-imager.json + - name: Move in seperate dir + run: | + mkdir upload + mv rpi-imager.json ./upload + + - name: Upload to remote server + uses: SamKirkland/FTP-Deploy-Action@4.3.3 + with: + server: ${{ secrets.OSHOST }} + username: ${{ secrets.OSUSER }} + password: ${{ secrets.OSPASSWORD }} + local-dir: ./upload/ + + update-changelog: + needs: update-rpi-imager + name: Generate changelog + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: 'develop' + token: ${{ secrets.PAT }} + fetch-depth: 0 + + - name: Get latest tag + id: latest_tag + shell: bash + run: | + echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT + - name: Generate a changelog + uses: orhun/git-cliff-action@v1 + id: git-cliff + with: + config: cliff.toml + args: 0.5.0..${{ steps.latest_tag.outputs.TAG_NAME }} + env: + OUTPUT: ${{ github.workspace }}/CHANGELOG.md -# -# - name: Upload to remote server -# uses: SamKirkland/FTP-Deploy-Action@4.3.3 -# with: -# server: ${{ secrets.REMOTEHOST }} -# username: ${{ secrets.REMOTEUSER }} -# password: ${{ secrets.REMOTEPASSWORD }} -# dangerous-clean-slate: true -# local-dir: ./dist/ -# -# update-changelog: -# needs: ['release'] -# name: Generate changelog -# runs-on: ubuntu-latest -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# with: -# ref: 'develop' -# token: ${{ secrets.PAT }} -# fetch-depth: 0 -# -# - name: Get latest tag -# id: latest_tag -# shell: bash -# run: | -# echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT -# -# - name: Generate a changelog -# uses: orhun/git-cliff-action@v1 -# id: git-cliff -# with: -# config: cliff.toml -# args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }} -# env: -# OUTPUT: ${{ github.workspace }}/CHANGELOG.md -# -# - name: Show CHANGELOG -# run: | -# cat CHANGELOG.md -# - uses: stefanzweifel/git-auto-commit-action@v4 -# with: -# commit_message: 'docs(changelog): update changelog' -# file_pattern: CHANGELOG.md + - name: Show CHANGELOG + run: | + cat CHANGELOG.md + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'docs(changelog): update changelog' + file_pattern: CHANGELOG.md diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 000000000..56a90c00e --- /dev/null +++ b/cliff.toml @@ -0,0 +1,74 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ + +# Changelog +All notable changes to Mainsail will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}](https://github.com/mainsail-crew/mainsail/releases/tag/{{version}}) - {{ timestamp | date(format="%Y-%m-%d") }} +\ +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %}\ + ### {{ group | split(pat="$") | last | upper_first }} + {% for commit in commits + | filter(attribute="scope") + | sort(attribute="scope") %} + - **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + {%- endfor -%} + {%- for commit in commits %} + {%- if commit.scope -%} + {% else -%} + {% raw %}\n{% endraw %}\ + - {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\ + {%- if commit.breaking %} + {% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}} + {%- endif -%} + {% endif -%} + {% endfor -%} + {% raw %}\n{% endraw %} +{% endfor %}\n\ +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ +""" + +[git] +# allow only conventional commits +# https://www.conventionalcommits.org +conventional_commits = true +filter_unconventional = false +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits + { message = "^chore: push version number to", group = "9$Other", skip = true}, # Old redundant commits + { message = "^feat(\\(.*\\))?:", group = "1$Features"}, + { message = "^feature(\\(.*\\))?:", group = "1$Features"}, + { message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"}, + { message = "^docs(\\(.*\\))?:", group = "7$Documentation"}, + { message = "^perf(\\(.*\\))?:", group = "3$Performance"}, + { message = "^refactor(\\(.*\\))?:", group = "4$Refactor"}, + { message = "^style(\\(.*\\))?:", group = "5$Styling"}, + { message = "^test(\\(.*\\))?:", group = "9$Other"}, + { message = "^locale(\\(.*\\))?:", group = "6$Localization"}, + { message = "^chore(\\(.*\\))?:", group = "9$Other"}, + { body = ".*security", group = "Security"}, + { message = "release v2.1.2", group = "Release"}, # workaround for v2.1.2 release +] +# filter out the commits that are not matched by commit parsers +filter_commits = true +ignore_tags="v*-(beta|rc)*" +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" From 2ea5fd9ff7ccacf76823d288f699460ccea61ab2 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 11 Dec 2022 23:42:07 +0100 Subject: [PATCH 38/40] chore: WIP Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index c2f0396d4..efa216c3a 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -127,7 +127,7 @@ jobs: steps: - name: Build image id: build - uses: mainsail-crew/MainsailOS-actions/dummy-image@master + uses: mainsail-crew/MainsailOS-actions/build-image@master with: config: ${{ matrix.config }} build-ref: master From c3414ccd038476fec3edc8928af2628f9a8be542 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Mon, 12 Dec 2022 08:08:24 +0100 Subject: [PATCH 39/40] chore: remove old release workflow Signed-off-by: Stefan Dej --- .github/workflows/ReleaseRaspiOS.yml | 95 ---------------------------- 1 file changed, 95 deletions(-) delete mode 100644 .github/workflows/ReleaseRaspiOS.yml diff --git a/.github/workflows/ReleaseRaspiOS.yml b/.github/workflows/ReleaseRaspiOS.yml deleted file mode 100644 index 875616e8a..000000000 --- a/.github/workflows/ReleaseRaspiOS.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build and Release MainsailOS - Raspberry Pi OS buster -on: - release: - types: [ published ] - -env: - DOWNLOAD_URL_CHECKSUM: "https://downloads.raspberrypi.org/raspios_lite_armhf_latest.sha256" - DOWNLOAD_URL_IMAGE: "https://downloads.raspberrypi.org/raspios_lite_armhf_latest.torrent" - FILENAME_CHECKSUM: "raspios_lite_armhf_latest.sha256" - -jobs: - raspiosbuild: - runs-on: ubuntu-latest - - steps: - - name: Install Dependencies - run: sudo apt update; sudo apt install --yes coreutils p7zip-full qemu-user-static zip - - - name: Checkout CustomPiOS - uses: actions/checkout@v2 - with: - repository: "guysoft/CustomPiOS" - path: CustomPiOS - - - name: Checkout MainsailOS Project - uses: actions/checkout@v2 - with: - repository: ${{ github.repository }} - path: repository - submodules: true - - - name: Raspberry Pi OS Checksum - id: raspios-checksum - run: | - cd repository/src/image - wget -O $FILENAME_CHECKSUM $DOWNLOAD_URL_CHECKSUM - FILE_CONTENT=$(head -n 1 $FILENAME_CHECKSUM) - CHECKSUM=$(echo $FILE_CONTENT | cut -d' ' -f1) - echo "::set-output name=CHECKSUM::$CHECKSUM" - - - name: Cache Raspberry Pi OS Source Image - id: cache-source-image - uses: actions/cache@v3 - with: - path: repository/src/image/*.img.xz - key: ${{ runner.os }}-${{ steps.raspios-checksum.outputs.CHECKSUM }} - - - name: Download Raspberry Pi OS Source Image - if: steps.cache-source-image.outputs.cache-hit != 'true' - run: aria2c -d repository/src/image --seed-time=0 $DOWNLOAD_URL_IMAGE - - - name: Comparing Checksums - run: | - cd repository/src/image - cat $FILENAME_CHECKSUM | awk '{print $1" "$2}' | sha256sum -c - - - name: Update CustomPiOS Paths - run: cd repository/src && ../../CustomPiOS/src/update-custompios-paths - - - name: Build Image - run: sudo modprobe loop && cd repository/src && sudo bash -x ./build_dist - - - name: Copy output image - run: cp ${{ github.workspace }}/repository/src/workspace/*-raspios-*-lite.img MainsailOS-buster-lite-${{ github.event.release.tag_name }}.img - - - name: Compress the image - run: zip MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip MainsailOS-buster-lite-${{ github.event.release.tag_name }}.img - - - name: Generate sha256 Checksum - run: sha256sum MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip > MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip.sha256 - - - uses: actions/upload-artifact@v2 - with: - name: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip - path: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip - - - name: Upload MainsailOS (Raspios buster based) Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip - asset_name: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip - asset_content_type: application/zip - - - name: Upload MainsailOS sha256 Checksum Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip.sha256 - asset_name: MainsailOS-buster-lite-${{ github.event.release.tag_name }}.zip.sha256 - asset_content_type: text/plain From c86b68a67b5418389ec7215bc2ea2e5427381da1 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Mon, 12 Dec 2022 08:09:35 +0100 Subject: [PATCH 40/40] chore: remove upload of uncompressed image Signed-off-by: Stefan Dej --- .github/workflows/Release.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index efa216c3a..1d1501e21 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -145,15 +145,6 @@ jobs: echo "base_name=${base_name}" >> $GITHUB_OUTPUT echo "image=${image}" >> $GITHUB_OUTPUT - - name: Upload Image - if: success() - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ needs.release.outputs.id }} - file: ${{ github.workspace }}/${{ steps.copy-image.outputs.image }}.img - - name: Upload failed Logfile if: failure() uses: actions/upload-artifact@v3