[前][次][番号順一覧][スレッド一覧]

ruby-changes:57805

From: Kazuhiro <ko1@a...>
Date: Thu, 19 Sep 2019 12:47:30 +0900 (JST)
Subject: [ruby-changes:57805] 9fb9f2d318 (master): Add draft-release.yml [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=9fb9f2d318

From 9fb9f2d318520ddfdbe73809eea85847550b42ae Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Thu, 19 Sep 2019 12:39:52 +0900
Subject: Add draft-release.yml [ci skip]

Make draft release packages. (Release packages are official after tests and release announce.)

- Copy from ruby/actions
- Change trigger tags from `draft/v*` to `v*` (I use `draft/v*` on ruby/actions because I want to avoid to cause trouble with shell history on working directory of ruby/ruby.)
- Change secrets names because secrets are repository local and use different names between ruby/ruby and ruby/actions.

diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml
new file mode 100644
index 0000000..b76de55
--- /dev/null
+++ b/.github/workflows/draft-release.yml
@@ -0,0 +1,161 @@ https://github.com/ruby/ruby/blob/trunk/.github/workflows/draft-release.yml#L1
+name: Make draft release package
+
+on:
+  push:
+    tags:
+      - 'v*'
+
+jobs:
+  build-draft-release:
+    runs-on: ubuntu-latest
+    steps:
+      - run: env | sort
+      - name: Dump GitHub context
+        env:
+          GITHUB_CONTEXT: ${{ toJson(github) }}
+        run: echo "$GITHUB_CONTEXT"
+      - name: Dump job context
+        env:
+          JOB_CONTEXT: ${{ toJson(job) }}
+        run: echo "$JOB_CONTEXT"
+      - name: Dump steps context
+        env:
+          STEPS_CONTEXT: ${{ toJson(steps) }}
+        run: echo "$STEPS_CONTEXT"
+      - name: Dump runner context
+        env:
+          RUNNER_CONTEXT: ${{ toJson(runner) }}
+        run: echo "$RUNNER_CONTEXT"
+      - name: Dump strategy context
+        env:
+          STRATEGY_CONTEXT: ${{ toJson(strategy) }}
+        run: echo "$STRATEGY_CONTEXT"
+      - name: Dump matrix context
+        env:
+          MATRIX_CONTEXT: ${{ toJson(matrix) }}
+        run: echo "$MATRIX_CONTEXT"
+      - name: Install libraries
+        run: |
+          set -x
+          sudo apt-get update -q
+          sudo apt-get install --no-install-recommends -q -y build-essential git bison autoconf ruby p7zip-full curl
+      - name: Checkout ruby/ruby for tool/make-snapshot
+        run: git clone --depth=1 https://github.com/ruby/ruby ruby
+      - name: Make pkg
+        run: |
+          set -x
+          GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#/draft/#/#")
+          TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
+          if ruby -e "major, minor, = '${TARGET_VERSION}'.split('.').map(&:to_i); exit(major<=2 && minor<7)"; then
+            ruby ruby/tool/make-snapshot -svn pkg ${TARGET_VERSION}
+          else
+            # e.g. refs/tags/draft/v2_7_0_preview1
+            pushd ruby
+            git fetch --shallow-since='2018-12-25 00:00:00'
+            git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
+            git fetch origin +refs/notes/commits:refs/notes/commits
+            popd
+            ruby ruby/tool/make-snapshot -srcdir=ruby pkg ${TARGET_VERSION}
+          fi
+      - name: Check pkg
+        run: |
+          set -x
+          GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#/draft/#/#")
+          TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
+          ls -al pkg
+          7z x pkg/ruby-${TARGET_VERSION}.zip ruby-${TARGET_VERSION}/revision.h
+          cat ruby-${TARGET_VERSION}/revision.h
+          7z l pkg/ruby-${TARGET_VERSION}.zip ruby-${TARGET_VERSION}/ChangeLog
+      - name: Upload s3
+        run: |
+          set -x
+          GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#/draft/#/#")
+          TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
+          for ext in .tar.gz .tar.bz2 .tar.xz .zip; do
+            aws s3 cp "pkg/ruby-${TARGET_VERSION}$ext" "s3://ftp.r-l.o/pub/tmp/ruby-${TARGET_VERSION}$ext.draft" --no-progress
+            curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/pub/tmp/ruby-${TARGET_VERSION}$ext.draft"
+          done
+        env:
+          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+      - uses: k0kubun/action-slack@v...
+        with:
+          payload: |
+            {
+              "attachments": [{
+                title: "Draft Release ${{ github.ref }}",
+                title_link: "https://cache.ruby-lang.org/pub/tmp/",
+                "text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }}> ",
+                "color": "danger"
+              }]
+            }
+        env:
+          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+        if: failure()
+
+  check-draft-release:
+    needs: build-draft-release
+    runs-on: ubuntu-latest
+    steps:
+      - name: Install libraries
+        run: |
+          set -x
+          sudo apt-get update -q
+          sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev bison- autoconf- ruby- git-
+      - name: Download draft
+        run: |
+          set -x
+          GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#/draft/#/#")
+          TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
+          curl -sSLo ruby-${TARGET_VERSION}.tar.xz https://cache.ruby-lang.org/pub/tmp/ruby-${TARGET_VERSION}.tar.xz.draft
+      - name: Extract
+        run: |
+          set -x
+          GITHUB_REF=$(echo $GITHUB_REF | sed -e "s#/draft/#/#")
+          TARGET_VERSION=$(echo $GITHUB_REF | sed -e "s#refs/tags/v##" -e "s/_\([a-z]\)/-\1/" -e "y/_/./")
+          tar xf ruby-${TARGET_VERSION}.tar.xz
+      - name: Fixed world writable dirs
+        run: |
+          chmod go-w $HOME
+          sudo chmod -R go-w /usr/share
+      - name: Set ENV
+        run: |
+          echo '##[set-env name=JOBS]'-j$((1 + $(nproc --all)))
+      - name: configure
+        run: cd ruby-*/ && ./configure
+      - name: make
+        run: cd ruby-*/ && make $JOBS
+      - name: make check
+        run: cd ruby-*/ && make $JOBS check TESTOPTS="-q --tty=no" MSPECOPT="-ff"
+      - name: make install
+        run: cd ruby-*/ && sudo make $JOBS install
+      - name: ruby -v
+        run: ruby -v
+      - uses: k0kubun/action-slack@v...
+        with:
+          payload: |
+            {
+              "attachments": [{
+                title: "Check Draft Release ${{ github.ref }}",
+                title_link: "https://cache.ruby-lang.org/pub/tmp/",
+                "text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} check-draft-release>",
+                "color": "danger"
+              }]
+            }
+        env:
+          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+        if: failure()
+      - uses: k0kubun/action-slack@v...
+        with:
+          payload: |
+            {
+              "attachments": [{
+                title: "Check Draft Release ${{ github.ref }}",
+                title_link: "https://cache.ruby-lang.org/pub/tmp/",
+                "text": "${{ job.status }}: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks|${{ github.workflow }} check-draft-release>",
+                "color": "good"
+              }]
+            }
+        env:
+          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+        if: success()
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]