Parcourir la source

update release.yml

Yuki Takei il y a 3 ans
Parent
commit
9e748b7a30
1 fichiers modifiés avec 125 ajouts et 99 suppressions
  1. 125 99
      .github/workflows/release.yml

+ 125 - 99
.github/workflows/release.yml

@@ -3,8 +3,9 @@ name: Release
 on:
 on:
   pull_request:
   pull_request:
     branches:
     branches:
-      - release/current
-      - release/*.*.*
+      # - release/current
+      # - release/*.*.*
+      - release/test
     types: [closed]
     types: [closed]
 
 
 jobs:
 jobs:
@@ -15,7 +16,7 @@ jobs:
     if: github.event.pull_request.merged == true
     if: github.event.pull_request.merged == true
 
 
     outputs:
     outputs:
-      RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}
+      RELEASED_VERSION: ${{ steps.package-json.outputs.packageVersion }}-TEST
 
 
     steps:
     steps:
     - uses: actions/checkout@v3
     - uses: actions/checkout@v3
@@ -64,128 +65,154 @@ jobs:
     - uses: ncipollo/release-action@v1
     - uses: ncipollo/release-action@v1
       with:
       with:
         body: ${{ github.event.pull_request.body }}
         body: ${{ github.event.pull_request.body }}
-        tag: v${{ steps.package-json.outputs.packageVersion }}
+        tag: v${{ steps.package-json.outputs.packageVersion }}-TEST
         token: ${{ secrets.GITHUB_TOKEN }}
         token: ${{ secrets.GITHUB_TOKEN }}
 
 
-    - name: Delete drafts
-      uses: hugo19941994/delete-draft-releases@v1.0.0
-      env:
-        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
-
-  create-pr-for-next-rc:
+    # - name: Delete drafts
+    #   uses: hugo19941994/delete-draft-releases@v1.0.0
+    #   env:
+    #     GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+
+  # create-pr-for-next-rc:
+  #   needs: create-github-release
+
+  #   runs-on: ubuntu-latest
+
+  #   steps:
+  #   - uses: actions/checkout@v3
+  #     with:
+  #       ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
+
+  #   - uses: actions/setup-node@v3
+  #     with:
+  #       node-version: '16'
+  #       cache: 'yarn'
+  #       cache-dependency-path: '**/yarn.lock'
+
+  #   - name: Install dependencies
+  #     run: |
+  #       npx lerna bootstrap
+
+  #   - name: Bump versions for next RC
+  #     run: |
+  #       yarn bump-versions:rc
+  #       yarn bump-versions:slackbot-proxy
+
+  #   - name: Retrieve information from package.json
+  #     uses: myrotvorets/info-from-package-json-action@1.2.0
+  #     id: package-json
+
+  #   - name: Commit
+  #     uses: github-actions-x/commit@v2.9
+  #     with:
+  #       github-token: ${{ secrets.GITHUB_TOKEN }}
+  #       push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
+  #       commit-message: 'Bump version'
+  #       name: GitHub Action
+
+  #   - name: Create PR
+  #     uses: repo-sync/pull-request@v2
+  #     with:
+  #       source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
+  #       destination_branch: master
+  #       pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
+  #       pr_label: exclude from changelog,prepare next version
+  #       pr_body: "An automated PR generated by create-pr-for-next-rc"
+  #       github_token: ${{ secrets.GITHUB_TOKEN }}
+
+
+  determine-tags:
     needs: create-github-release
     needs: create-github-release
-
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
+    outputs:
+      TAGS: ${{ steps.meta.outputs.tags }}
+      TAGS_GHCR: ${{ steps.meta-ghcr.outputs.tags }}
+
     steps:
     steps:
     - uses: actions/checkout@v3
     - uses: actions/checkout@v3
-      with:
-        ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
-
-    - uses: actions/setup-node@v3
-      with:
-        node-version: '16'
-        cache: 'yarn'
-        cache-dependency-path: '**/yarn.lock'
-
-    - name: Install dependencies
-      run: |
-        npx lerna bootstrap
-
-    - name: Bump versions for next RC
-      run: |
-        yarn bump-versions:rc
-        yarn bump-versions:slackbot-proxy
 
 
     - name: Retrieve information from package.json
     - name: Retrieve information from package.json
       uses: myrotvorets/info-from-package-json-action@1.2.0
       uses: myrotvorets/info-from-package-json-action@1.2.0
       id: package-json
       id: package-json
 
 
-    - name: Commit
-      uses: github-actions-x/commit@v2.9
+    - name: Docker meta for docker.io
+      uses: docker/metadata-action@v4
       with:
       with:
-        github-token: ${{ secrets.GITHUB_TOKEN }}
-        push-branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
-        commit-message: 'Bump version'
-        name: GitHub Action
+        images: docker.io/weseek/growi-codebuild-test
+        sep-tags: ','
+        tags: |
+          type=raw,value=latest
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
 
 
-    - name: Create PR
-      uses: repo-sync/pull-request@v2
+    - name: Docker meta for ghcr.io
+      uses: docker/metadata-action@v4
       with:
       with:
-        source_branch: support/prepare-v${{ steps.package-json.outputs.packageVersion }}
-        destination_branch: master
-        pr_title: Prepare v${{ steps.package-json.outputs.packageVersion }}
-        pr_label: exclude from changelog,prepare next version
-        pr_body: "An automated PR generated by create-pr-for-next-rc"
-        github_token: ${{ secrets.GITHUB_TOKEN }}
+        images: ghcr.io/weseek/growi-codebuild-test
+        sep-tags: ','
+        tags: |
+          type=raw,value=latest
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
+          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
 
 
 
 
   build-image:
   build-image:
     needs: create-github-release
     needs: create-github-release
 
 
+    uses: weseek/growi/.github/workflows/reusable-app-build-image.yml@rc/6.0.3-with-codebuild
+    with:
+      source-version:  refs/tags/v{{ needs.create-github-release.outputs.RELEASED_VERSION }}
+      image-name: weseek/growi-codebuild-test
+      tag-temporary: latest
+    secrets:
+      AWS_ROLE_TO_ASSUME_FOR_OIDC: ${{ secrets.AWS_ROLE_TO_ASSUME_FOR_OIDC }}
+
+
+  publish-image:
+    needs: [determine-tags, build-image]
+
+    uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@rc/6.0.3-with-codebuild
+    with:
+      tags: ${{ needs.determine-tags.outputs.TAGS }}
+      registry: docker.io
+      image-name: weseek/growi-codebuild-test
+      tag-temporary: latest
+    secrets:
+      DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
+
+  publish-image-ghcr:
+    needs: [determine-tags, build-image]
+
+    uses: weseek/growi/.github/workflows/reusable-app-create-manifests.yml@rc/6.0.3-with-codebuild
+    with:
+      tags: ${{ needs.determine-tags.outputs.TAGS_GHCR }}
+      registry: ghcr.io
+      image-name: weseek/growi-codebuild-test
+      tag-temporary: latest
+    secrets:
+      DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
+
+
+  post-publish:
+    needs: [create-github-release, publish-image, publish-image-ghcr]
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
 
 
-    strategy:
-      matrix:
-        platform: [linux/amd64, linux/arm64]
-
     steps:
     steps:
     - uses: actions/checkout@v3
     - uses: actions/checkout@v3
       with:
       with:
         ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
         ref: v${{ needs.create-github-release.outputs.RELEASED_VERSION }}
-        lfs: true
-
-    - name: Docker meta
-      id: meta
-      uses: docker/metadata-action@v4
-      with:
-        images: weseek/growi,ghcr.io/weseek/growi
-        tags: |
-          type=raw,value=latest
-          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}
-          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}
-          type=semver,value=${{ needs.create-github-release.outputs.RELEASED_VERSION }},pattern={{major}}.{{minor}}.{{patch}}
-
-    - name: Login to Docker Hub
-      uses: docker/login-action@v2
-      with:
-        username: wsmoogle
-        password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
 
 
-    - name: Login to GitHub Container Registry
-      uses: docker/login-action@v2
-      with:
-        registry: ghcr.io
-        username: wsmoogle
-        password: ${{ secrets.DOCKER_REGISTRY_ON_GITHUB_PASSWORD }}
-
-    - name: Set up QEMU
-      if: ${{ matrix.platform == 'linux/arm64' }}
-      uses: docker/setup-qemu-action@v1
-
-    - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@v2
-
-    - name: Build and push
-      uses: docker/build-push-action@v3
-      with:
-        context: .
-        file: ./packages/app/docker/Dockerfile
-        platforms: ${{ matrix.platform }}
-        push: true
-        builder: ${{ steps.buildx.outputs.name }}
-        cache-from: type=gha
-        cache-to: type=gha,mode=max
-        tags: ${{ steps.meta.outputs.tags }}
-
-    - name: Update Docker Hub Description
-      uses: peter-evans/dockerhub-description@v3
-      with:
-        username: wsmoogle
-        password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
-        repository: weseek/growi
-        readme-filepath: ./packages/app/docker/README.md
+    # - name: Update Docker Hub Description
+    #   uses: peter-evans/dockerhub-description@v3
+    #   with:
+    #     username: wsmoogle
+    #     password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
+    #     repository: weseek/growi
+    #     readme-filepath: ./packages/app/docker/README.md
 
 
     - name: Slack Notification
     - name: Slack Notification
       uses: weseek/ghaction-release-slack-notification@master
       uses: weseek/ghaction-release-slack-notification@master
@@ -193,7 +220,6 @@ jobs:
         channel: '#release'
         channel: '#release'
         url: ${{ secrets.SLACK_WEBHOOK_URL }}
         url: ${{ secrets.SLACK_WEBHOOK_URL }}
         created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
         created_tag: 'v${{ needs.create-github-release.outputs.RELEASED_VERSION }}'
-        message: '*Release v${{ needs.create-github-release.outputs.RELEASED_VERSION }} (${{ matrix.platform }})* Succeeded'
 
 
     - name: Check whether workspace is clean
     - name: Check whether workspace is clean
       run: |
       run: |