2323# ------------------------------------------------------------------------------------
2424# Github Actions
2525# ------------------------------------------------------------------------------------
26- name : Node.js AntPickax CI
26+ name : NodeJS addon AntPickax CI
2727
2828#
2929# Events
4141 schedule :
4242 - cron : ' 0 15 * * 0'
4343
44+ #
45+ # Npm Trusted Publishing + OIDC
46+ #
47+ permissions :
48+ contents : write
49+ id-token : write
50+
4451#
4552# Jobs
4653#
5562 fail-fast : false
5663
5764 matrix :
58- node-version : [18, 20, 22]
65+ container :
66+ - ubuntu:24.04
67+ - ubuntu:22.04
68+ - debian:trixie
69+ - debian:bookworm
70+ - debian:bullseye
71+ - rockylinux/rockylinux:10
72+ - rockylinux:9
73+ - rockylinux:8
74+ - fedora:42
75+ - fedora:41
76+ - alpine:3.22
77+ - alpine:3.21
78+ - alpine:3.20
5979
80+ node-version :
81+ - 20
82+ - 22
83+ - 24
84+
85+ container :
86+ image : ${{ matrix.container }}
87+
88+ env :
89+ #
90+ # Installation special environment variables for ubuntu(debian).
91+ #
92+ DEBIAN_FRONTEND : noninteractive
93+
94+ # [NOTE] about shell
95+ # In rockylinux:10, an error occurs when executing that the shell(sh) cannot be found.
96+ # Therefore, each step is executed with an explicit shell(specified full path like /bin/sh).
97+ #
6098 steps :
6199 #
62100 # Checks-out your repository under $GITHUB_WORKSPACE, so your
@@ -65,45 +103,49 @@ jobs:
65103 - name : Checkout sources
66104 uses : actions/checkout@v4
67105
68- - name : Use Node.js ${{ matrix.node-version }}
69- uses : actions/setup-node@v4
70- with :
71- node-version : ${{ matrix.node-version }}
72-
73106 #
74107 # Set environments from secrets
75108 #
76109 # [NOTE] Secrets
77110 # Use Secrets of organization or repository as parameters to
78- # pass to nodejs_helper .sh for building and packaging, .
111+ # pass to nodejs_addon_helper .sh for building and packaging.
79112 #
80113 # The available Secret variables are listed below:
114+ # GITHUB_TOKEN : Github token(automatically set by github actions)
81115 # NODEJS_TYPE_VARS_FILE : specify custom variables file
82- # * NPM_TOKEN : The token for publishing to npm
83116 # FORCE_PUBLISHER : nodejs major version to publish packages
84117 # FORCE_NOT_PUBLISHER : do not allow to publish any packages(for forked repository)
85118 # USE_PACKAGECLOUD_REPO : true means using pacakgecloud.io repo, false is not using
86119 # PACKAGECLOUD_OWNER : owner name as a pat of path to packagcloud.io for downloading
87120 # PACKAGECLOUD_DOWNLOAD_REPO : repo name as a pat of path to packagcloud.io for downloading
121+ # NPM_TOKEN : [Deprecated] The token for publishing to npm
88122 #
89- # "NPM_TOKEN" is required variable to publish the package.
123+ # NPM Trusted Publisher for NPM package should be set, so you won't need
124+ # to specify NPM_TOKEN.
125+ # If you set NPM_TOKEN(not recommended), it will be used to publish.
126+ # When publishing a package to an NPM repository, you need to upload the
127+ # package for the first time and then configure NPM Trusted Publisher.
128+ # For this reason, specify NPM_TOKEN the first time you upload a package.
129+ # From the second time onwards (after configuring NPM Trusted Publisher),
130+ # delete NPM_TOKEN.
90131 #
91132 - name : Set environments from secrets
92133 run : |
134+ echo "ENV_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "${GITHUB_ENV}"
93135 echo "ENV_NODEJS_TYPE_VARS_FILE=${{ secrets.NODEJS_TYPE_VARS_FILE }}" >> "${GITHUB_ENV}"
94- echo "ENV_NPM_TOKEN=${{ secrets.NPM_TOKEN }}" >> "${GITHUB_ENV}"
95136 echo "ENV_FORCE_PUBLISHER=${{ secrets.FORCE_PUBLISHER }}" >> "${GITHUB_ENV}"
96137 echo "ENV_FORCE_NOT_PUBLISHER=${{ secrets.FORCE_NOT_PUBLISHER }}" >> "${GITHUB_ENV}"
97138 echo "ENV_USE_PACKAGECLOUD_REPO=${{ secrets.USE_PACKAGECLOUD_REPO }}" >> "${GITHUB_ENV}"
98139 echo "ENV_PACKAGECLOUD_OWNER=${{ secrets.PACKAGECLOUD_OWNER }}" >> "${GITHUB_ENV}"
99140 echo "ENV_PACKAGECLOUD_DOWNLOAD_REPO=${{ secrets.PACKAGECLOUD_DOWNLOAD_REPO }}" >> "${GITHUB_ENV}"
141+ echo "ENV_NPM_TOKEN=${{ secrets.NPM_TOKEN }}" >> "${GITHUB_ENV}"
100142
101143 #
102144 # Run building and packaging helper
103145 #
104146 - name : Run building and packaging
105147 run : |
106- /bin/sh -c "$GITHUB_WORKSPACE/.github/workflows/nodejs_helper .sh -node ${{ matrix.node-version }}"
148+ /bin/sh -c "$GITHUB_WORKSPACE/.github/workflows/nodejs_addon_helper .sh -os ${{ matrix.container }} -node ${{ matrix.node-version }}"
107149
108150#
109151# Local variables:
0 commit comments