Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
<!-- Do NOT remove existing tasks, append additional tasks -->
- [ ] Verify the Required Checks are Passing
- [ ] Update the [README.md](../blob/master/README.md) _if applicable_
- <!-- This step is completely optional -->
- [ ] Update the [documentation](https://github.com/cssnr/portainer-stack-deploy-docs) _if applicable_

<!-- Optional: To enable hard mode you can also update the docs: https://github.com/cssnr/portainer-stack-deploy-docs -->
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ Additionally, you can support other GitHub Actions I have published:
- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
- [Portainer Stack Deploy Action](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
- [Docker Context Action](https://github.com/cssnr/docker-context-action?tab=readme-ov-file#readme)
- [Actions Up Action](https://github.com/cssnr/actions-up-action?tab=readme-ov-file#readme)
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
Expand All @@ -703,6 +704,7 @@ Additionally, you can support other GitHub Actions I have published:

These actions are not published on the Marketplace, but may be useful.

- [cssnr/create-files-action](https://github.com/cssnr/create-files-action?tab=readme-ov-file#readme) - Create various files from templates.
- [cssnr/draft-release-action](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) - Keep a draft release ready to publish.
- [cssnr/env-json-action](https://github.com/cssnr/env-json-action?tab=readme-ov-file#readme) - Convert env file to json or vice versa.
- [cssnr/push-artifacts-action](https://github.com/cssnr/push-artifacts-action?tab=readme-ov-file#readme) - Sync files to a remote host with rsync.
Expand Down
118 changes: 86 additions & 32 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34804,7 +34804,7 @@ const https = __nccwpck_require__(4708)

class Portainer {
/**
* Portainer API
* Portainer API - https://app.swaggerhub.com/apis/portainer/portainer-ce/
* @param {string} url
* @param {string} token
* @param {object} [headers]
Expand All @@ -34816,6 +34816,7 @@ class Portainer {
const agent = new https.Agent({
rejectUnauthorized: false,
})
// noinspection JSCheckFunctionSignatures
this.client = axios.create({
baseURL: url,
headers: { 'X-API-Key': token, ...headers },
Expand All @@ -34828,7 +34829,17 @@ class Portainer {

/**
* Get Version
* @return {Promise<object>}
* @typedef {object} Version - https://app.swaggerhub.com/apis/portainer/portainer-ce/#/system.versionResponse
* @property {boolean} UpdateAvailable
* @property {string} LatestVersion
* @property {string} ServerVersion
* @property {string} VersionSupport
* @property {string} ServerEdition
* @property {string} DatabaseVersion
* @property {object} Build
* @property {object} Dependencies
* @property {object} Runtime
* @return {Promise<Version>}
*/
async getVersion() {
const response = await this.client.get('/system/version')
Expand All @@ -34847,7 +34858,19 @@ class Portainer {
/**
* Get Swarm
* @param {string|number} endpointId
* @return {Promise<object>}
* @typedef {object} Swarm
* @property {string} CreatedAt
* @property {number} DataPathPort
* @property {string[]} DefaultAddrPool
* @property {string} ID
* @property {object} JoinTokens
* @property {boolean} RootRotationInProgress
* @property {object} Spec
* @property {number} SubnetSize
* @property {object} TLSInfo
* @property {string} UpdatedAt
* @property {object} Version
* @return {Promise<Swarm>}
*/
async getSwarm(endpointId) {
const response = await this.client.get(`/endpoints/${endpointId}/docker/swarm`)
Expand All @@ -34856,7 +34879,33 @@ class Portainer {

/**
* Get Stacks
* @return {Promise<object[]>}
* @typedef {object} Stack - https://app.swaggerhub.com/apis/portainer/portainer-ce/#/portainer.Stack
* @property {number} Id
* @property {string} Name
* @property {number} Type
* @property {number} EndpointId
* @property {string} SwarmId
* @property {string} EntryPoint
* @property {Env[]} Env
* @property {object} ResourceControl
* @property {number} Status
* @property {string} ProjectPath
* @property {number} CreationDate
* @property {string} CreatedBy
* @property {number} UpdateDate
* @property {string} UpdatedBy
* @property {object} AdditionalFiles
* @property {object} AutoUpdate
* @property {object} Option
* @property {object} GitConfig
* @property {boolean} FromAppTemplate
* @property {string} Namespace
*
* @typedef {object} Env
* @property {string} name
* @property {string} value
*
* @return {Promise<Stack[]>}
*/
async getStacks() {
const response = await this.client.get('/stacks')
Expand All @@ -34865,10 +34914,10 @@ class Portainer {

/**
* Update Stack Repository
* @param {string} stackID
* @param {string|number} stackID
* @param {string|number} endpointId
* @param {object} body
* @return {Promise<object>}
* @return {Promise<Stack>}
*/
async updateStackRepo(stackID, endpointId, body) {
const response = await this.client.put(`/stacks/${stackID}/git/redeploy`, body, {
Expand All @@ -34882,7 +34931,7 @@ class Portainer {
* @param {string|number} endpointId
* @param {object} body
* @param {string} [url]
* @return {Promise<object>}
* @return {Promise<Stack>}
*/
async createStackRepo(endpointId, body, url) {
if (body.swarmID) {
Expand All @@ -34898,10 +34947,10 @@ class Portainer {

/**
* Update Stack String
* @param {string} stackID
* @param {string|number} stackID
* @param {string|number} endpointId
* @param {object} body
* @return {Promise<object>}
* @return {Promise<Stack>}
*/
async updateStackString(stackID, endpointId, body) {
const response = await this.client.put(`/stacks/${stackID}`, body, {
Expand All @@ -34915,7 +34964,7 @@ class Portainer {
* @param {string|number} endpointId
* @param {object} body
* @param {string} [url]
* @return {Promise<object>}
* @return {Promise<Stack>}
*/
async createStackString(endpointId, body, url) {
if (body.swarmID) {
Expand Down Expand Up @@ -36855,16 +36904,16 @@ module.exports = parseParams
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {

"use strict";
/*! Axios v1.13.1 Copyright (c) 2025 Matt Zabriskie and contributors */
/*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors */


const FormData$1 = __nccwpck_require__(6454);
const crypto = __nccwpck_require__(6982);
const url = __nccwpck_require__(7016);
const http2 = __nccwpck_require__(5675);
const proxyFromEnv = __nccwpck_require__(7777);
const http = __nccwpck_require__(8611);
const https = __nccwpck_require__(5692);
const http2 = __nccwpck_require__(5675);
const util = __nccwpck_require__(9023);
const followRedirects = __nccwpck_require__(1573);
const zlib = __nccwpck_require__(3106);
Expand All @@ -36879,6 +36928,7 @@ const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
const proxyFromEnv__default = /*#__PURE__*/_interopDefaultLegacy(proxyFromEnv);
const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
const http2__default = /*#__PURE__*/_interopDefaultLegacy(http2);
const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects);
const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
Expand Down Expand Up @@ -39015,7 +39065,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
return requestedURL;
}

const VERSION = "1.13.1";
const VERSION = "1.13.2";

function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
Expand Down Expand Up @@ -39592,13 +39642,6 @@ const brotliOptions = {
finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
};

const {
HTTP2_HEADER_SCHEME,
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_STATUS
} = http2.constants;

const isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);

const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
Expand Down Expand Up @@ -39628,9 +39671,9 @@ class Http2Sessions {
sessionTimeout: 1000
}, options);

let authoritySessions;
let authoritySessions = this.sessions[authority];

if ((authoritySessions = this.sessions[authority])) {
if (authoritySessions) {
let len = authoritySessions.length;

for (let i = 0; i < len; i++) {
Expand All @@ -39641,7 +39684,7 @@ class Http2Sessions {
}
}

const session = http2.connect(authority, options);
const session = http2__default["default"].connect(authority, options);

let removed;

Expand All @@ -39656,11 +39699,12 @@ class Http2Sessions {

while (i--) {
if (entries[i][0] === session) {
entries.splice(i, 1);
if (len === 1) {
delete this.sessions[authority];
return;
} else {
entries.splice(i, 1);
}
return;
}
}
};
Expand Down Expand Up @@ -39699,12 +39743,12 @@ class Http2Sessions {

session.once('close', removeSession);

let entries = this.sessions[authority], entry = [
session,
options
];
let entry = [
session,
options
];

entries ? this.sessions[authority].push(entry) : authoritySessions = this.sessions[authority] = [entry];
authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];

return session;
}
Expand Down Expand Up @@ -39832,6 +39876,13 @@ const http2Transport = {

const session = http2Sessions.getSession(authority, http2Options);

const {
HTTP2_HEADER_SCHEME,
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_STATUS
} = http2__default["default"].constants;

const http2Headers = {
[HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
[HTTP2_HEADER_METHOD]: options.method,
Expand Down Expand Up @@ -40411,6 +40462,9 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
req
));
});
} else {
// explicitly reset the socket timeout value for a possible `keep-alive` request
req.setTimeout(0);
}


Expand Down Expand Up @@ -42282,7 +42336,7 @@ const Portainer = __nccwpck_require__(1055)
// console.log('stack:', stack)
core.info(`Updated Stack ${stack.Id}: ${stack.Name}`)
} else {
core.info(' Stack NOT Found - Deploying NEW Stack')
core.info('Stack NOT Found - Deploying NEW Stack')
const body = {
name: inputs.name,
swarmID,
Expand Down Expand Up @@ -42325,7 +42379,7 @@ const Portainer = __nccwpck_require__(1055)
* @function getEnv
* @param {Inputs} inputs
* @param {object} stack
* @return {object[]} Portainer formatted environment
* @return {Env[]}
*/
function getEnv(inputs, stack) {
if (!inputs.env_data && !inputs.env_file) {
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
},
"dependencies": {
"@actions/core": "^1.11.1",
"axios": "^1.13.1",
"axios": "^1.13.2",
"dotenv": "^17.2.3",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@eslint/js": "^9.39.0",
"@eslint/js": "^9.39.1",
"@vercel/ncc": "^0.38.4",
"eslint": "^9.39.0",
"eslint": "^9.39.1",
"prettier": "^3.6.2"
}
}
Loading