diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6bd19cc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: Build and Update Latest + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.head_commit.author.name != 'GitHub Action' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t nos2x-build . + + - name: Run Docker container and extract nos2x.zip + run: | + docker create --name nos2x-container nos2x-build + docker start nos2x-container + docker cp nos2x-container:/app/nos2x.zip ./nos2x.zip + docker rm -f nos2x-container + + - name: Verify nos2x.zip + run: | + ls -l nos2x.zip + md5sum nos2x.zip + file nos2x.zip + + - name: Archive nos2x.zip + uses: actions/upload-artifact@v4 + with: + name: nos2x-extension + path: nos2x.zip + + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT + + - name: Update latest.md + run: | + echo "# Latest Build" > latest.md + echo "Last updated: ${{ steps.date.outputs.date }}" >> latest.md + echo "Download the latest build [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> latest.md + + - name: Commit and push latest.md + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + git add latest.md + git commit -m "Update latest build link" || exit 0 # Exit gracefully if no changes + git push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6fff0c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:18 + +WORKDIR /app +# Install zip and justfile +RUN apt-get update && apt-get install -y zip +RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin + + +COPY package.json ./ +RUN yarn install + +COPY . . + +RUN cat package.json +RUN ls -la + +RUN just build +RUN just package