From f7a2c60a633f114f522d0d10ca4d668f9c115407 Mon Sep 17 00:00:00 2001 From: bcarlin Date: Thu, 26 Dec 2024 21:56:12 +0100 Subject: [PATCH 01/11] test workflow --- .forgejo/workflows/build.yaml | 48 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index a1cb245..2d29ebc 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -2,8 +2,8 @@ on: push: branches: - main - #paths: - # - 'src/*.v' + paths: + - 'src/*.v' jobs: build: name: Build and upload binary @@ -23,30 +23,28 @@ jobs: /tmp/v/v -prod . - name: Upload binary as generic package and create a release run: | - VERSION="$(date +'%y.%m.%d').$GITHUB_REF_NAME" - #wget -q https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 -o jq - #chmod +x jq + set -e + VERSION="$(date +'%y.%m.%d').$(git rev-parse --short HEAD)" + echo Download jq + wget -q https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 -O jq + chmod +x jq - # Create a tag - #git tag "$VERSION" - #git push --tags + echo Create a tag + git tag "$VERSION" + git push --tags - # Create a release - #curl -X POST -H "Authorization: token $GITHUB_TOKEN" \ - # -H "Content-Type: application/json" \ - # --data '{"name": "'$VERSION'", "tag": "'$VERSION'"}' \ - # "https://code.bcarlin.net/api/repos/actions/setup-browser/releases" + echo Create a release + OUT=$(curl --silent -X POST -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + --data '{"name": "'$VERSION'", "tag_name": "'$VERSION'"}' \ + "$GITHUB_API_URL/repos/actions/setup-browser/releases" \ + | tee /dev/stderr) - #REL_ID=$(curl -H "Authorization: token $GITHUB_TOKEN" "https://forgejo.example.com/api/repos/actions/setup-browser/releases/latest" | ./jq .id) + UP_URL=$(echo "$OUT" | ./jq -r .upload_url ) - # Add the binary to the release - #curl -X 'POST' --header "Authorization: token $GITHUB_TOKEN" \ - # "https://code.bcarlin.net/api/v1/repos/actions/setup-browser/releases/$REL_ID/assets?name=setup-browser" \ - # -H 'accept: application/json' \ - # -H 'Content-Type: multipart/form-data' \ - # -F 'external_url=' - - # Upload the binary as a generic package - curl -v --header "Authorization: token $GITHUB_TOKEN" \ - --upload-file setup-browser \ - "https://code.bcarlin.net/api/packages/actions/generic/setup-browser/$VERSION/setup-browser" + echo Add the binary to the release + curl --silent -X 'POST' --header "Authorization: token $GITHUB_TOKEN" \ + "$UP_URL" \ + -H 'accept: application/json' \ + -H 'Content-Type: multipart/form-data' \ + -F 'attachment=@setup-browser' From 8b45d00667ce6fae4873ebacda1e1f1d1dc04b93 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 00:40:49 +0100 Subject: [PATCH 02/11] feat: add action definition --- action.yaml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 action.yaml diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..44622c8 --- /dev/null +++ b/action.yaml @@ -0,0 +1,39 @@ +name: 'Setup Browser' +description: | + Installs a browser from various sources to use for tests. + Are supported: + + - Ungoogled Chromium (`uchromium`), aailable versions are listed [here](https://ungoogled-software.github.io/ungoogled-chromium-binaries/releases/appimage/64bit/) +inputs: + target: + description: | + The browser and ersion to install in the form `BROWSER:VERSION`. + The version is optional. + required: true + install-path: + description: | + The path where the binary should be installed. + The path is added to the system PATH for subsequent steps. +runs: + using: "composite" + steps: + - name: Download setup-browser + working-directory: ${{ github.action_path }} + run: | + wget -q https://code.bcarlin.net/actions/setup-browser/releases/download/latest/setup-browser + chmod +x setup-browser + shell: bash + + - name: Download the browser + working-directory: ${{ github.action_path }} + run: | + INSTALL_PATH=${INSTALL_PATH:-/opt/${TARGET%%:*}} + ./setup-browser install \ + -cache-path cache \ + -install-to "$INSTALL_PATH" \ + ${{ inputs.target }} + echo "$(dirname "$INSTALL_PATH")" >> "$GITHUB_PATH" + shell: bash + env: + TARGET: ${{ inputs.target }} + INSTALL_PATH: ${{ inputs.install-path }} From 8bc10b14865da01766d84866d32c0a9705cf5604 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 00:55:55 +0100 Subject: [PATCH 03/11] chore(workflow): fix git tags creation --- .forgejo/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 2d29ebc..e572130 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -31,7 +31,8 @@ jobs: echo Create a tag git tag "$VERSION" - git push --tags + git tag -f v0 + git push --tags --force echo Create a release OUT=$(curl --silent -X POST -H "Authorization: token $GITHUB_TOKEN" \ From 5c2fefee0dbee95b6656e92b1cb5d3608119fccc Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:01:34 +0100 Subject: [PATCH 04/11] misc fixes --- .forgejo/workflows/build.yaml | 1 - .forgejo/workflows/move-action-tag.yaml | 18 ++++++++++++++++++ action.yaml | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .forgejo/workflows/move-action-tag.yaml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index e572130..3345e4c 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -31,7 +31,6 @@ jobs: echo Create a tag git tag "$VERSION" - git tag -f v0 git push --tags --force echo Create a release diff --git a/.forgejo/workflows/move-action-tag.yaml b/.forgejo/workflows/move-action-tag.yaml new file mode 100644 index 0000000..dfb08ca --- /dev/null +++ b/.forgejo/workflows/move-action-tag.yaml @@ -0,0 +1,18 @@ +on: + push: + branches: + - main + paths: + - 'src/*.v' + - action.yml +jobs: + build: + name: Move action tag + runs-on: docker + steps: + - uses: actions/checkout@v4 + - name: Upload binary as generic package and create a release + run: | + set -e + git tag -f v0 + git push --tags --force diff --git a/action.yaml b/action.yaml index 44622c8..2ee12e7 100644 --- a/action.yaml +++ b/action.yaml @@ -27,11 +27,12 @@ runs: - name: Download the browser working-directory: ${{ github.action_path }} run: | + set -x INSTALL_PATH=${INSTALL_PATH:-/opt/${TARGET%%:*}} ./setup-browser install \ -cache-path cache \ -install-to "$INSTALL_PATH" \ - ${{ inputs.target }} + "${TARGET}" echo "$(dirname "$INSTALL_PATH")" >> "$GITHUB_PATH" shell: bash env: From f44b83d8546112f4b48ca6119a39b8a692d26f24 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:26:53 +0100 Subject: [PATCH 05/11] install AppImage dependencies --- action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yaml b/action.yaml index 2ee12e7..3a65a13 100644 --- a/action.yaml +++ b/action.yaml @@ -28,6 +28,8 @@ runs: working-directory: ${{ github.action_path }} run: | set -x + apt-get update && apt-get install libfuse2 + INSTALL_PATH=${INSTALL_PATH:-/opt/${TARGET%%:*}} ./setup-browser install \ -cache-path cache \ From 14c4328fdd7122afc42c791d0cee3a687e8f565b Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:29:44 +0100 Subject: [PATCH 06/11] fix(worflow): no worflow were run when action.yaml was changed --- .forgejo/workflows/move-action-tag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/move-action-tag.yaml b/.forgejo/workflows/move-action-tag.yaml index dfb08ca..1c34a70 100644 --- a/.forgejo/workflows/move-action-tag.yaml +++ b/.forgejo/workflows/move-action-tag.yaml @@ -4,7 +4,7 @@ on: - main paths: - 'src/*.v' - - action.yml + - action.yaml jobs: build: name: Move action tag From 01f1e3612fe2ba0de91249d97c4000d73db3ce02 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:30:49 +0100 Subject: [PATCH 07/11] misc for test --- .forgejo/workflows/move-action-tag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/move-action-tag.yaml b/.forgejo/workflows/move-action-tag.yaml index 1c34a70..1a5d0b6 100644 --- a/.forgejo/workflows/move-action-tag.yaml +++ b/.forgejo/workflows/move-action-tag.yaml @@ -7,7 +7,7 @@ on: - action.yaml jobs: build: - name: Move action tag + name: Move action v0 tag runs-on: docker steps: - uses: actions/checkout@v4 From 1917eeb3ca67239377a2527899151e2abba4b6b7 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:31:55 +0100 Subject: [PATCH 08/11] typo --- action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 3a65a13..3556934 100644 --- a/action.yaml +++ b/action.yaml @@ -3,7 +3,8 @@ description: | Installs a browser from various sources to use for tests. Are supported: - - Ungoogled Chromium (`uchromium`), aailable versions are listed [here](https://ungoogled-software.github.io/ungoogled-chromium-binaries/releases/appimage/64bit/) + - Ungoogled Chromium (`uchromium`), available versions are listed + [here](https://ungoogled-software.github.io/ungoogled-chromium-binaries/releases/appimage/64bit/). inputs: target: description: | From d926e3d3f1f7765e6d16218f09a9c57ded297046 Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:33:04 +0100 Subject: [PATCH 09/11] fix(worflow): fix step title --- .forgejo/workflows/move-action-tag.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/move-action-tag.yaml b/.forgejo/workflows/move-action-tag.yaml index 1a5d0b6..44516d7 100644 --- a/.forgejo/workflows/move-action-tag.yaml +++ b/.forgejo/workflows/move-action-tag.yaml @@ -11,7 +11,7 @@ jobs: runs-on: docker steps: - uses: actions/checkout@v4 - - name: Upload binary as generic package and create a release + - name: move v0 tag run: | set -e git tag -f v0 From 15a3493a4ef1c1a9e8bec06276ee61dfadcf412a Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:36:24 +0100 Subject: [PATCH 10/11] fix(action): enable fuse --- action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yaml b/action.yaml index 3556934..0aaba5c 100644 --- a/action.yaml +++ b/action.yaml @@ -30,6 +30,7 @@ runs: run: | set -x apt-get update && apt-get install libfuse2 + modprobe fuse INSTALL_PATH=${INSTALL_PATH:-/opt/${TARGET%%:*}} ./setup-browser install \ From 737fe3aa7af6a38f1a6a5ac96588e3a54b7ee09f Mon Sep 17 00:00:00 2001 From: Bruno Carlin Date: Fri, 27 Dec 2024 01:43:34 +0100 Subject: [PATCH 11/11] fixaction): appimage run needs an env var --- action.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yaml b/action.yaml index 0aaba5c..c4b2d56 100644 --- a/action.yaml +++ b/action.yaml @@ -29,15 +29,13 @@ runs: working-directory: ${{ github.action_path }} run: | set -x - apt-get update && apt-get install libfuse2 - modprobe fuse - INSTALL_PATH=${INSTALL_PATH:-/opt/${TARGET%%:*}} ./setup-browser install \ -cache-path cache \ -install-to "$INSTALL_PATH" \ "${TARGET}" echo "$(dirname "$INSTALL_PATH")" >> "$GITHUB_PATH" + echo "APPIMAGE_EXTRACT_AND_RUN=true" >> "$GITHUB_ENV" shell: bash env: TARGET: ${{ inputs.target }}