125 lines (104 loc) · 4.23 KB
/
bundle_tags.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#/
# @license Apache-2.0
#
# Copyright (c) 2022 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#/
# Workflow name:
name: bundle_tags
# Workflow triggers:
on:
# Run workflow when a new tag is pushed to the repository:
push:
tags:
- '*'
# Workflow jobs:
jobs:
# Define job to wait a minute before running the workflow...
waiting:
# Define display name:
name: 'Waiting Period'
# Define the type of virtual host machine on which to run the job:
runs-on: ubuntu-latest
# Define the steps to run:
steps:
# Wait three minutes:
- name: 'Wait three minutes'
run: |
sleep 3m
# Define job to publish bundle tags to GitHub...
create-tags:
# Define display name:
name: 'Create bundle tags'
# Define the type of virtual host machine on which to run the job:
runs-on: ubuntu-latest
# Indicate that this job depends on the prior job finishing:
needs: waiting
# Define the steps to run:
steps:
# Wait for the productionize workflow to succeed:
- name: 'Wait for productionize workflow to succeed'
uses: lewagon/wait-on-check-action@v1.0.0
timeout-minutes: 5
with:
ref: main
check-regexp: 'Productionize'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60
allowed-conclusions: success
# Checkout the repository:
- name: 'Checkout repository'
uses: actions/checkout@v3
# Configure git:
- name: 'Configure git'
run: |
git config --local user.email "noreply@stdlib.io"
git config --local user.name "stdlib-bot"
git fetch --all
# Create bundle tags:
- name: 'Create bundle tags'
run: |
SLUG=${{ github.repository }}
VERSION=$(echo ${{ github.ref }} | sed -E -n 's/refs\/tags\/?(v[0-9]+.[0-9]+.[0-9]+).*/\1/p')
ESCAPED=$(echo $SLUG | sed -E 's/\//\\\//g')
git checkout -b deno origin/deno
sed -i -E "s/$ESCAPED@deno/$ESCAPED@$VERSION-deno/g" README.md
git add README.md
git commit -m "Update README.md for Deno bundle $VERSION"
git tag -a $VERSION-deno -m "$VERSION-deno"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-deno
sed -i -E "s/$ESCAPED@$VERSION-deno/$ESCAPED@deno/g" README.md
git add README.md
git commit -m "Revert changes to README.md for Deno bundle $VERSION"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno
git checkout -b umd origin/umd
sed -i -E "s/$ESCAPED@umd/$ESCAPED@$VERSION-umd/g" README.md
git add README.md
git commit -m "Update README.md for UMD bundle $VERSION"
git tag -a $VERSION-umd -m "$VERSION-umd"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-umd
sed -i -E "s/$ESCAPED@$VERSION-umd/$ESCAPED@umd/g" README.md
git add README.md
git commit -m "Revert changes to README.md for UMD bundle $VERSION"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" umd
git checkout -b esm origin/esm
sed -i -E "s/$ESCAPED@esm/$ESCAPED@$VERSION-esm/g" README.md
git add README.md
git commit -m "Update README.md for ESM bundle $VERSION"
git tag -a $VERSION-esm -m "$VERSION-esm"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" $VERSION-esm
sed -i -E "s/$ESCAPED@$VERSION-esm/$ESCAPED@esm/g" README.md
git add README.md
git commit -m "Revert changes to README.md for ESM bundle $VERSION"
git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" esm