Compare commits

...

6 Commits

Author SHA1 Message Date
Shahrzad Mahro
a8fc81a461
Merge 9629e69267 into 11bd71901b 2024-10-24 12:01:20 +00:00
Shahrzad Mahro
9629e69267
Merge pull request #11 from 09306677806/09306677806-patch-1
Create Man:0x858badB062FcEc1fBF5898151e3b45B1f1B30088
2024-10-24 15:31:16 +03:30
Shahrzad Mahro
e3936f7290
Merge branch 'main' into 09306677806-patch-1 2024-10-24 15:30:06 +03:30
Shahrzad Mahro
b392e97be9
Create tencent.yml0x7dB738F5c400f3734A9550aF79d0bF72339a6279
https://t.me/boinker_bot/boinkapp?startapp==0x0cF8e180350253271f4b917CcFb0aCCc4862F262
2024-10-24 02:58:41 +03:30
John Wesley Walker III
11bd71901b
Prepare 4.2.2 Release (#1953)
* Prepare 4.2.2 Release

---------

Co-authored-by: Josh Gross <joshmgross@github.com>
2024-10-23 16:24:28 +02:00
John Wesley Walker III
e3d2460bbb
Expand unit test coverage (#1946) 2024-10-23 15:59:08 +02:00
5 changed files with 123 additions and 3 deletions

79
.github/workflows/tencent.yml vendored Normal file
View File

@ -0,0 +1,79 @@
# This workflow will build a docker container, publish and deploy it to Tencent Kubernetes Engine (TKE) when there is a push to the "main" branch.
#
# To configure this workflow:
#
# 1. Ensure that your repository contains the necessary configuration for your Tencent Kubernetes Engine cluster,
# including deployment.yml, kustomization.yml, service.yml, etc.
#
# 2. Set up secrets in your workspace:
# - TENCENT_CLOUD_SECRET_ID with Tencent Cloud secret id
# - TENCENT_CLOUD_SECRET_KEY with Tencent Cloud secret key
# - TENCENT_CLOUD_ACCOUNT_ID with Tencent Cloud account id
# - TKE_REGISTRY_PASSWORD with TKE registry password
#
# 3. Change the values for the TKE_IMAGE_URL, TKE_REGION, TKE_CLUSTER_ID and DEPLOYMENT_NAME environment variables (below).
name: Tencent Kubernetes Engine
on:
push:
branches: [ "main" ]
# Environment variables available to all jobs and steps in this workflow
env:
TKE_IMAGE_URL: ccr.ccs.tencentyun.com/demo/mywebapp
TKE_REGION: ap-guangzhou
TKE_CLUSTER_ID: cls-mywebapp
DEPLOYMENT_NAME: tke-test
permissions:
contents: read
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
# Build
- name: Build Docker image
run: |
docker build -t ${TKE_IMAGE_URL}:${GITHUB_SHA} .
- name: Login TKE Registry
run: |
docker login -u ${{ secrets.TENCENT_CLOUD_ACCOUNT_ID }} -p '${{ secrets.TKE_REGISTRY_PASSWORD }}' ${TKE_IMAGE_URL}
# Push the Docker image to TKE Registry
- name: Publish
run: |
docker push ${TKE_IMAGE_URL}:${GITHUB_SHA}
- name: Set up Kustomize
run: |
curl -o kustomize --location https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
- name: Set up ~/.kube/config for connecting TKE cluster
uses: TencentCloud/tke-cluster-credential-action@v1
with:
secret_id: ${{ secrets.TENCENT_CLOUD_SECRET_ID }}
secret_key: ${{ secrets.TENCENT_CLOUD_SECRET_KEY }}
tke_region: ${{ env.TKE_REGION }}
cluster_id: ${{ env.TKE_CLUSTER_ID }}
- name: Switch to TKE context
run: |
kubectl config use-context ${TKE_CLUSTER_ID}-context-default
# Deploy the Docker image to the TKE cluster
- name: Deploy
run: |
./kustomize edit set image ${TKE_IMAGE_URL}:${GITHUB_SHA}
./kustomize build . | kubectl apply -f -
kubectl rollout status deployment/${DEPLOYMENT_NAME}
kubectl get services -o wide

View File

@ -1,5 +1,9 @@
# Changelog
## v4.2.2
* `url-helper.ts` now leverages well-known environment variables by @jww3 in https://github.com/actions/checkout/pull/1941
* Expand unit test coverage for `isGhes` by @jww3 in https://github.com/actions/checkout/pull/1946
## v4.2.1
* Check out other refs/* by commit if provided, fall back to ref by @orhantoy in https://github.com/actions/checkout/pull/1924

View File

@ -24,13 +24,50 @@ describe('getServerUrl tests', () => {
})
describe('isGhes tests', () => {
const pristineEnv = process.env
beforeEach(() => {
jest.resetModules()
process.env = {...pristineEnv}
})
afterAll(() => {
process.env = pristineEnv
})
it('basics', async () => {
delete process.env['GITHUB_SERVER_URL']
expect(urlHelper.isGhes()).toBeFalsy()
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
expect(urlHelper.isGhes('https://contoso.ghe.com')).toBeFalsy()
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
expect(urlHelper.isGhes('https://src.onpremise.fabrikam.com')).toBeTruthy()
})
it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => {
delete process.env['GITHUB_SERVER_URL']
expect(urlHelper.isGhes()).toBeFalsy()
})
it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com'
expect(urlHelper.isGhes()).toBeFalsy()
})
it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com'
expect(urlHelper.isGhes()).toBeFalsy()
})
it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost'
expect(urlHelper.isGhes()).toBeFalsy()
})
it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com'
expect(urlHelper.isGhes()).toBeTruthy()
})
})
describe('getServerApiUrl tests', () => {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "checkout",
"version": "4.2.1",
"version": "4.2.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "checkout",
"version": "4.2.1",
"version": "4.2.2",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.10.1",

View File

@ -1,6 +1,6 @@
{
"name": "checkout",
"version": "4.2.1",
"version": "4.2.2",
"description": "checkout action",
"main": "lib/main.js",
"scripts": {