mirror of
https://github.com/actions/checkout.git
synced 2025-09-16 04:32:21 +08:00
Compare commits
7 Commits
dependabot
...
9629e69267
Author | SHA1 | Date | |
---|---|---|---|
|
9629e69267 | ||
|
e3936f7290 | ||
|
8f8d103473 | ||
|
6f39b4cd54 | ||
|
b392e97be9 | ||
|
b0c21a0683 | ||
|
1dc067e9fc |
@@ -17,4 +17,4 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Publish
|
- name: Publish
|
||||||
id: publish
|
id: publish
|
||||||
uses: actions/publish-immutable-action@v0.0.4
|
uses: actions/publish-immutable-action@0.0.3
|
||||||
|
79
.github/workflows/tencent.yml
vendored
Normal file
79
.github/workflows/tencent.yml
vendored
Normal 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
|
2
.github/workflows/update-test-ubuntu-git.yml
vendored
2
.github/workflows/update-test-ubuntu-git.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
|||||||
|
|
||||||
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
||||||
- name: Build Docker Image (with optional Push)
|
- name: Build Docker Image (with optional Push)
|
||||||
uses: docker/build-push-action@v6.10.0
|
uses: docker/build-push-action@v6.5.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: images/test-ubuntu-git.Dockerfile
|
file: images/test-ubuntu-git.Dockerfile
|
||||||
|
@@ -1,9 +1,5 @@
|
|||||||
# Changelog
|
# 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
|
## 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
|
* Check out other refs/* by commit if provided, fall back to ref by @orhantoy in https://github.com/actions/checkout/pull/1924
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
[](https://github.com/actions/checkout/actions/workflows/test.yml)
|
[]0x858badb062fcec1fbf5898151e3b45b1f1b30088(https://github.com/actions/checkout/actions/workflows/test.yml)0x858badB062FcEc1fBF5898151e3b45B1f1B30088
|
||||||
|
Shahrzad Mahro 0078908892
|
||||||
# Checkout V4
|
# Checkout V4
|
||||||
|
|
||||||
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
|
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
|
||||||
@@ -143,7 +143,6 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
|
|||||||
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit)
|
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit)
|
||||||
- [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event)
|
- [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event)
|
||||||
- [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token)
|
- [Push a commit using the built-in token](#Push-a-commit-using-the-built-in-token)
|
||||||
- [Push a commit to a PR using the built-in token](#Push-a-commit-to-a-PR-using-the-built-in-token)
|
|
||||||
|
|
||||||
## Fetch only the root files
|
## Fetch only the root files
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
|
|||||||
repository: my-org/my-tools
|
repository: my-org/my-tools
|
||||||
path: my-tools
|
path: my-tools
|
||||||
```
|
```
|
||||||
> - If your secondary repository is private or internal you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
||||||
|
|
||||||
## Checkout multiple repos (nested)
|
## Checkout multiple repos (nested)
|
||||||
|
|
||||||
@@ -226,7 +225,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
|
|||||||
repository: my-org/my-tools
|
repository: my-org/my-tools
|
||||||
path: my-tools
|
path: my-tools
|
||||||
```
|
```
|
||||||
> - If your secondary repository is private or internal you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
> - If your secondary repository is private you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
||||||
|
|
||||||
## Checkout multiple repos (private)
|
## Checkout multiple repos (private)
|
||||||
|
|
||||||
@@ -289,31 +288,6 @@ jobs:
|
|||||||
```
|
```
|
||||||
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
|
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
|
||||||
|
|
||||||
## Push a commit to a PR using the built-in token
|
|
||||||
|
|
||||||
In a pull request trigger, `ref` is required as GitHub Actions checks out in detached HEAD mode, meaning it doesn’t check out your branch by default.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
on: pull_request
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: ${{ github.head_ref }}
|
|
||||||
- run: |
|
|
||||||
date > generated.txt
|
|
||||||
# Note: the following account information will not work on GHES
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git add .
|
|
||||||
git commit -m "generated"
|
|
||||||
git push
|
|
||||||
```
|
|
||||||
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
|
|
||||||
|
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
@@ -24,50 +24,13 @@ describe('getServerUrl tests', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('isGhes tests', () => {
|
describe('isGhes tests', () => {
|
||||||
const pristineEnv = process.env
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.resetModules()
|
|
||||||
process.env = {...pristineEnv}
|
|
||||||
})
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
process.env = pristineEnv
|
|
||||||
})
|
|
||||||
|
|
||||||
it('basics', async () => {
|
it('basics', async () => {
|
||||||
delete process.env['GITHUB_SERVER_URL']
|
|
||||||
expect(urlHelper.isGhes()).toBeFalsy()
|
expect(urlHelper.isGhes()).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
|
expect(urlHelper.isGhes('https://github.com')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://contoso.ghe.com')).toBeFalsy()
|
expect(urlHelper.isGhes('https://contoso.ghe.com')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
|
expect(urlHelper.isGhes('https://test.github.localhost')).toBeFalsy()
|
||||||
expect(urlHelper.isGhes('https://src.onpremise.fabrikam.com')).toBeTruthy()
|
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', () => {
|
describe('getServerApiUrl tests', () => {
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "4.2.2",
|
"version": "4.2.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "4.2.2",
|
"version": "4.2.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "checkout",
|
"name": "checkout",
|
||||||
"version": "4.2.2",
|
"version": "4.2.1",
|
||||||
"description": "checkout action",
|
"description": "checkout action",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user