From fadf9f6370ee66d3e6a3c28dd363f118bb0e56fd Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Tue, 13 Dec 2022 18:32:13 +0200 Subject: [PATCH] ci: automatic release action configure the Github Action to automatically create a release of the chip when pushing a tag --- .github/workflows/build.yaml | 49 ++++++++++++++++++++++++++++++++++++ .github/workflows/chip.yaml | 26 ------------------- 2 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/chip.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..31cad8c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,49 @@ +name: Build Chip + +on: + push: + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Build chip + uses: wokwi/wokwi-chip-clang-action@main + with: + sources: "src/main.c" + - name: Copy chip.json + run: sudo cp chip.json dist + - name: 'Upload Artifacts' + uses: actions/upload-artifact@v3 + with: + name: chip + path: | + dist/chip.json + dist/chip.wasm + + # The release job only runs when you push a tag starting with "v", e.g. v1.0.0 + release: + name: Release + needs: build + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Download compiled chip + uses: actions/download-artifact@v3 + with: + name: chip + path: chip + - name: Create a zip archive + run: cd chip && zip -9 ../chip.zip chip.* + env: + ZIP_VERSION: ${{ github.ref_name }} + - name: Upload release + uses: ncipollo/release-action@v1 + with: + artifacts: chip.zip + token: ${{ secrets.GITHUB_TOKEN }} + generateReleaseNotes: true diff --git a/.github/workflows/chip.yaml b/.github/workflows/chip.yaml deleted file mode 100644 index c8b3bd2..0000000 --- a/.github/workflows/chip.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build Chip - -on: - push: - workflow_dispatch: - -jobs: - exporter: - runs-on: ubuntu-22.04 - name: Build - steps: - - name: Check out repository - uses: actions/checkout@v3 - - name: Build chip - uses: wokwi/wokwi-chip-clang-action@main - with: - sources: "src/main.c" - - name: Copy chip.json - run: sudo cp chip.json dist - - name: 'Upload Artifacts' - uses: actions/upload-artifact@v3 - with: - name: chip - path: | - dist/chip.json - dist/chip.wasm