From f60cd5a7b7ecc48243311e85f40fd587cfcd5d2d Mon Sep 17 00:00:00 2001 From: Ricardo Lanziano Date: Sun, 5 May 2024 01:26:02 -0500 Subject: [PATCH] Fix CORS request for the web installer Signed-off-by: Ricardo Lanziano --- .github/workflows/docs.yaml | 1 - .github/workflows/esp32-mkimage.yaml | 48 +++++++++++++++++++++++----- installer/manifest.json | 2 +- 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index bf2f7e6..8a50651 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -46,7 +46,6 @@ jobs: - name: Generate documentation run: | rebar3 ex_doc - cp installer/manifest.json doc/ - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/.github/workflows/esp32-mkimage.yaml b/.github/workflows/esp32-mkimage.yaml index b098877..6cfdee9 100644 --- a/.github/workflows/esp32-mkimage.yaml +++ b/.github/workflows/esp32-mkimage.yaml @@ -14,6 +14,7 @@ on: paths: - '.github/workflows/esp32-mkimage.yaml' - 'src/**' + workflow_dispatch: permissions: contents: write @@ -23,10 +24,9 @@ concurrency: cancel-in-progress: true jobs: - esp32-release: + build-and-release: runs-on: ubuntu-latest container: espressif/idf:v${{ matrix.idf-version }} - strategy: matrix: idf-version: ["5.2"] @@ -55,11 +55,10 @@ jobs: elixir-version: ${{ matrix.elixir_version }} rebar3-version: '3.23.0' - - name: "APT update" - run: apt update -y - - - name: "Install deps" - run: DEBIAN_FRONTEND=noninteractive apt install -y ${{ matrix.compiler_pkgs}} git cmake gperf zlib1g-dev + - name: "Install dependencies" + run: | + apt update -y + DEBIAN_FRONTEND=noninteractive apt install -y ${{ matrix.compiler_pkgs}} git cmake gperf zlib1g-dev # needed for generating AtomVM version when running in a docker container - name: "Configure Git" @@ -168,4 +167,37 @@ jobs: fail_on_unmatched_files: true files: | ./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img - ./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256 \ No newline at end of file + ./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256 + + publish: + name: "Publish new firmware and website to GitHub Pages" + runs-on: ubuntu-latest + needs: [build-and-release] + strategy: + matrix: + idf-version: ["5.2"] + cc: ["clang-15"] + cxx: ["clang++-15"] + cflags: ["-O3"] + otp: ["26"] + elixir_version: ["1.16"] + compiler_pkgs: ["clang-15"] + soc: ["esp32c3"] + steps: + - uses: actions/checkout@v3.5.3 + - uses: actions/download-artifact@v3.0.2 + with: + path: output + name: atomvm-${{ matrix.soc }}-image + - name: Create manifest.json + run: | + jq -n \ + --arg name "AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}" \ + --arg version "${{ github.run_number }}" \ + '{"name": $name, "version": $version, "files": [{"path": "./output/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img", "sha256": "$(cat ./output/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256)"}]}' > output/manifest.json + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4.4.1 + with: + branch: gh-pages + folder: output + clean: true diff --git a/installer/manifest.json b/installer/manifest.json index 24b152d..54afe66 100644 --- a/installer/manifest.json +++ b/installer/manifest.json @@ -5,7 +5,7 @@ { "chipFamily": "ESP32-C3", "parts": [ - { "path": "https://github.com/esl/c3card/releases/download/v0.2.0/AtomVM-c3card-esp32c3-master.img", "offset": 0 } + { "path": "https://github.io/esl/c3card/releases/download/latest/AtomVM-c3card-esp32c3-master.img", "offset": 0 } ] } ]