From 95890e6a5f22f7fa16dd7dcec767e54be2640267 Mon Sep 17 00:00:00 2001 From: Z4karia Date: Tue, 24 Sep 2024 16:21:15 +0200 Subject: [PATCH] ci: upload workflows --- .github/main.yaml | 34 ++++++++++++++++++++++++++++++++ .github/publish.yaml | 47 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/main.yaml create mode 100644 .github/publish.yaml diff --git a/.github/main.yaml b/.github/main.yaml new file mode 100644 index 0000000..55d372e --- /dev/null +++ b/.github/main.yaml @@ -0,0 +1,34 @@ +name: "main" +on: + - push + +jobs: + configure: + runs-on: ubuntu-latest + outputs: + uid_gid: ${{ steps.get-user.outputs.uid_gid }} + datetime: ${{ steps.get-datetime.outputs.datetime }} + steps: + - id: get-user + run: echo "::set-output name=uid_gid::$(id -u):$(id -g)" + - id: get-datetime + run: echo "::set-output name=datetime::$(date +'%Y%m%d%H%M%S')" + + build: + needs: [ configure ] + container: + image: zondax/rust-ci:latest + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Install node + uses: actions/setup-node@v2 + with: + node-version: "^16.10.0" + - name: Install dependencies + run: yarn install + - name: Run test + run: yarn test \ No newline at end of file diff --git a/.github/publish.yaml b/.github/publish.yaml new file mode 100644 index 0000000..b3ba0ab --- /dev/null +++ b/.github/publish.yaml @@ -0,0 +1,47 @@ +name: "Publish packages" + +on: + release: + types: + - created + tags: + - "v[0-9]+(\\.[0-9]+)*" + +jobs: + configure: + runs-on: ubuntu-latest + outputs: + datetime: ${{ steps.get-datetime.outputs.datetime }} + steps: + - id: get-datetime + run: echo "::set-output name=datetime::$(date +'%Y%m%d%H%M%S')" + + publish_npm_package: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Install node + uses: actions/setup-node@v2 + with: + node-version: '16' + registry-url: "https://registry.npmjs.org/" + scope: "@blooo" + - name: Install yarn + run: npm install -g yarn + - run: yarn install + - run: yarn build + - name: Get latest release version number + id: get_version + uses: battila7/get-version-action@v2 + - name: Update tag + run: | + echo Publishing as ${{ steps.get_version.outputs.version }} + npm --allow-same-version --no-git-tag-version version ${{ steps.get_version.outputs.version }} + - name: Publish package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH_AUTO_GLOBAL }} + run: | + npm publish \ No newline at end of file