Skip to content

Commit

Permalink
Fix CORS request for the web installer
Browse files Browse the repository at this point in the history
Signed-off-by: Ricardo Lanziano <[email protected]>
  • Loading branch information
arpunk committed May 8, 2024
1 parent b25c722 commit 1a83441
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
79 changes: 67 additions & 12 deletions .github/workflows/esp32-mkimage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ on:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'src/**'
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
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"]
Expand All @@ -47,19 +49,18 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
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"
Expand Down Expand Up @@ -147,9 +148,9 @@ jobs:
ls -l *.img
- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: atomvm-${{ matrix.soc }}-image
name: atomvm-c3card-${{ matrix.soc }}-image
path: ./AtomVM/src/platforms/esp32/build/atomvm-${{ matrix.soc }}.img
if-no-files-found: error

Expand All @@ -162,10 +163,64 @@ jobs:
sha256sum "${ATOMVM_IMG}" > "${ATOMVM_IMG}.sha256"
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
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
./AtomVM/src/platforms/esp32/build/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256
publish:
name: "Publish new firmware and website to GitHub Pages"
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
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:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
- name: Setup Erlang
uses: erlef/setup-beam@v1
with:
otp-version: '26.2'
rebar3-version: '3.23.0'
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Generate documentation
run: |
rebar3 ex_doc
- uses: actions/download-artifact@v4
with:
name: atomvm-c3card-${{ matrix.soc }}-image
path: output
- name: Create manifest.json
run: |
ATOMVM_IMG="AtomVM-${{ matrix.soc }}-${{ github.ref_name }}.img"
jq -n \
--arg name "AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}" \
--arg version "${{ github.run_number }}" \
'{"name": $name, "version": $version, "files": [{"path": "AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img", "sha256": "$(cat ./output/AtomVM-c3card-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256)"}]}' > doc/manifest.json
ls -R .
mv output/atomvm-${{ matrix.soc }}.img doc/"${ATOMVM_IMG}"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc
- name: Deploy to Github Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion installer/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]
}
]
Expand Down

0 comments on commit 1a83441

Please sign in to comment.