1111 contents : read
1212
1313 outputs :
14- version : ${{ steps.next.outputs.version }}
14+ full : ${{ steps.next.outputs.version }}
15+ short : ${{ steps.next.outputs.short }}
1516
1617 steps :
1718 - name : Fail the workflow if this is not the main branch
@@ -26,19 +27,49 @@ jobs:
2627 rustup toolchain install stable
2728 rustup default stable
2829
29- - name : Extract the current version
30- id : current
31- run : echo "version=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "mas-cli") | .version')" >> "$GITHUB_OUTPUT"
32-
3330 - name : Compute the new minor RC
3431 id : next
35- run :
echo "version=$(npx --yes [email protected] -i preminor --preid rc "${{ steps.current.outputs.version }}")" >> "$GITHUB_OUTPUT" 32+ run : |
33+ CURRENT_VERSION="$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "mas-cli") | .version')"
34+ NEXT_VERSION="$(npx --yes [email protected] -i preminor --preid rc "${CURRENT_VERSION}")" 35+ # compute the short minor version, e.g. 0.1.0-rc.1 -> 0.1
36+ SHORT_VERSION="$(echo "${NEXT_VERSION}" | cut -d. -f1-2)"
37+ echo "full=${NEXT_VERSION}" >> "$GITHUB_OUTPUT"
38+ echo "short=${SHORT_VERSION}" >> "$GITHUB_OUTPUT"
39+
40+ localazy :
41+ name : Create a new branch in Localazy
42+ runs-on : ubuntu-22.04
43+ needs : [compute-version]
44+
45+ permissions :
46+ contents : read
47+
48+ steps :
49+ - name : Checkout the code
50+ 51+
52+ - name : Install Node
53+ 54+ with :
55+ node-version : 20
56+
57+ - name : Install Localazy CLI
58+ run : npm install -g @localazy/cli
59+
60+ - name : Create a new branch in Localazy
61+ run : localazy branch -w "$LOCALAZY_WRITE_KEY" create main "$BRANCH"
62+ env :
63+ LOCALAZY_WRITE_KEY : ${{ secrets.LOCALAZY_WRITE_KEY }}
64+ # Localazy doesn't like slashes in branch names, so we just use the short version
65+ # For example, a 0.13.0 release will create a localazy branch named "v0.13" and a git branch named "release/v0.13"
66+ BRANCH : v${{ needs.compute-version.outputs.short }}
3667
3768 tag :
3869 uses : ./.github/workflows/tag.yaml
39- needs : compute-version
70+ needs : [ compute-version]
4071 with :
41- version : ${{ needs.compute-version.outputs.version }}
72+ version : ${{ needs.compute-version.outputs.full }}
4273 secrets :
4374 BOT_GITHUB_TOKEN : ${{ secrets.BOT_GITHUB_TOKEN }}
4475
@@ -54,23 +85,20 @@ jobs:
5485 - name : Create a new release branch
55865687 env :
57- VERSION : ${{ needs.compute-version.outputs.version }}
88+ BRANCH : release/v ${{ needs.compute-version.outputs.short }}
5889 SHA : ${{ needs.tag.outputs.sha }}
5990 with :
6091 github-token : ${{ secrets.BOT_GITHUB_TOKEN }}
6192 script : |
6293 const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
63-
64- // Only keep the major and minor version
65- const [major, minor, ...rest] = process.env.VERSION.split('.');
66- const branch = `release/${major}.${minor}`;
67-
68- const ref = `heads/${branch}`;
94+ const branch = process.env.BRANCH;
6995 const sha = process.env.SHA;
96+ const ref = `heads/${branch}`;
97+
7098 await github.rest.git.createRef({
7199 owner,
72100 repo,
73101 ref,
74102 sha,
75103 });
76- console.log(`Created branch ${branch}`);
104+ console.log(`Created branch ${branch} from ${sha} `);
0 commit comments