From 1e757a582f50c462a97126bd705d2c41afd1a503 Mon Sep 17 00:00:00 2001 From: Mutsuha Asada Date: Fri, 18 Oct 2024 12:43:19 +0900 Subject: [PATCH] add: workflows and version file --- .github/CODEOWNERS | 1 + .github/workflows/ci.yml | 12 ++++++++ .github/workflows/develop.yml | 56 +++++++++++++++++++++++++++++++++++ VERSION | 1 + 4 files changed, 70 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/develop.yml create mode 100644 VERSION diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..0cf6683 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @momeemt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..29d9554 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,12 @@ +name: CI +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - run: nix build diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 0000000..b5d945a --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,56 @@ +name: Develop +on: + push: + branches: + - develop + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - run: nix profile install nixpkgs#gh + - run: | + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + + - name: Get current version + id: version + run: echo "version=$(cat ./VERSION)" >> $GITHUB_OUTPUT + + - name: Get latest dev tag + id: new-tag + run: | + LATEST_TAG=$(gh release list --limit 100 | grep "v-${{ steps.version.outputs.version }}-dev-" | sort -V | tail -n 1 | awk '{print $3}') + if [ -z "$LATEST_TAG" ]; then + NEW_TAG="v-${{ steps.version.outputs.version }}-dev-1" + else + DEV_NUMBER=$(echo $LATEST_TAG | sed -E 's/^.*-dev-([0-9]+)$/\1/') + NEW_TAG="v-${{ steps.version.outputs.version }}-dev-$((DEV_NUMBER + 1))" + fi + echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT + + - run: nix build + + - name: Create Release + uses: actions/create-release@v1 + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.new-tag.outputs.new_tag }} + release_name: Develop release ${{ steps.new-tag.outputs.new_tag }} + draft: false + prerelease: true + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./result/std.pandoc.wasm + asset_name: std.pandoc.wasm + asset_content_type: application/wasm diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.1