You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/09/15 04:15:45 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #3082: ci(bindings/haskell): add release workflow

Xuanwo commented on code in PR #3082:
URL: https://github.com/apache/incubator-opendal/pull/3082#discussion_r1326770858


##########
.github/workflows/bindings_haskell.yml:
##########
@@ -70,3 +70,54 @@ jobs:
           path: |
             ~/.cabal/store
             bindings/haskell/dist-newstyle
+
+  package:
+    runs-on: ubuntu-latest
+    if: "startsWith(github.ref, 'refs/tags/')"
+    steps:
+      - uses: actions/checkout@v3
+      - name: Setup Haskell toolchain (ghc-9.2.8)
+        run: |
+          curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
+          ghcup install ghc 9.2.8 --set
+          ghcup install cabal --set
+          cabal update
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+      - name: Restore haskell cache
+        uses: actions/cache/restore@v3
+        with:
+          key: ${{ runner.os }}-haskell-${{ hashFiles('**/*.cabal', '**/Setup.hs') }}
+          path: |
+            ~/.cabal/store
+            bindings/haskell/dist-newstyle
+          restore-keys: ${{ runner.os }}-haskell-
+      - name: Package
+        working-directory: "bindings/haskell"
+        run: |
+          cargo package --target-dir target
+          cd target/package
+          tar xf opendal-hs-*.crate --strip-components=1
+          cabal sdist
+      - name: Publish candidate to Hackage
+        if: "contains(github.ref, 'rc')"
+        run: |
+          cabal upload -t ${{ secrets.HACKAGE_TOKEN }} bindings/haskell/target/package/dist-newstyle/sdist/*.tar.gz

Review Comment:
   We can't release anything until we have passed vote (even for rc tags). Please only upload release for our official tags.



##########
.github/workflows/bindings_haskell.yml:
##########
@@ -70,3 +70,54 @@ jobs:
           path: |
             ~/.cabal/store
             bindings/haskell/dist-newstyle
+
+  package:
+    runs-on: ubuntu-latest
+    if: "startsWith(github.ref, 'refs/tags/')"
+    steps:
+      - uses: actions/checkout@v3
+      - name: Setup Haskell toolchain (ghc-9.2.8)
+        run: |
+          curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
+          ghcup install ghc 9.2.8 --set
+          ghcup install cabal --set
+          cabal update
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+      - name: Restore haskell cache
+        uses: actions/cache/restore@v3
+        with:
+          key: ${{ runner.os }}-haskell-${{ hashFiles('**/*.cabal', '**/Setup.hs') }}
+          path: |
+            ~/.cabal/store
+            bindings/haskell/dist-newstyle
+          restore-keys: ${{ runner.os }}-haskell-
+      - name: Package
+        working-directory: "bindings/haskell"
+        run: |
+          cargo package --target-dir target
+          cd target/package
+          tar xf opendal-hs-*.crate --strip-components=1
+          cabal sdist
+      - name: Publish candidate to Hackage
+        if: "contains(github.ref, 'rc')"
+        run: |
+          cabal upload -t ${{ secrets.HACKAGE_TOKEN }} bindings/haskell/target/package/dist-newstyle/sdist/*.tar.gz
+      - name: Upload artifact
+        uses: actions/upload-artifact@v3
+        with:
+          name: bindings-haskell-sdist
+          path: bindings/haskell/target/package/dist-newstyle/sdist/*.tar.gz
+
+  release:
+    name: Release
+    runs-on: ubuntu-latest
+    if: "startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 'rc')"
+    needs: [package]
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: bindings-haskell-sdist
+      - name: Publish to Hackage
+        run: |
+          cabal upload -t ${{ secrets.HACKAGE_TOKEN }} --publish bindings/haskell/target/package/dist-newstyle/sdist/*.tar.gz

Review Comment:
   Please visit this token like:
   
   ```yaml
   - name: Load secret
     id: op-load-secret
     uses: 1password/load-secrets-action@v1
     with:
       export-env: true
     env:
       OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
       OPENDAL_HACKAGE_TOKEN: op://services/hackage/token
   ```
   
   And then use `OPENDAL_HACKAGE_TOKEN`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org