Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

PLPT-564 Adding Zip Upload Artifact #1

Merged
merged 3 commits into from
Sep 6, 2023
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
69 changes: 14 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,76 +13,35 @@ This template can be used to quickly start a new custom composite-run-steps acti
- [Updating the README.md](#updating-the-readmemd)
- [Code of Conduct](#code-of-conduct)
- [License](#license)

## TODOs

- README.md
- [ ] Update the Inputs section with the correct action inputs
- [ ] Update the Outputs section with the correct action outputs
- [ ] Update the Example section with the correct usage
- action.yml
- [ ] Fill in the correct name, description, inputs and outputs and implement steps
- CODEOWNERS
- [ ] Update as appropriate
- Repository Settings
- [ ] On the *Options* tab check the box to *Automatically delete head branches*
- [ ] On the *Options* tab update the repository's visibility
- [ ] On the *Branches* tab add a branch protection rule
- [ ] Check *Require pull request reviews before merging*
- [ ] Check *Dismiss stale pull request approvals when new commits are pushed*
- [ ] Check *Require review from Code Owners*
- [ ] Check *Require status checks to pass before merging*
- [ ] Check *Require branches to be up to date before merging*
- [ ] Add `update-readme` to the list of required status checks. This will need to be done after the first `auto-update-readme` workflow runs.
- [ ] Check *Do not allow bypassing the above settings*
- [ ] On the *Manage Access* tab add the appropriate groups
- About Section (accessed on the main page of the repo, click the gear icon to edit)
- [ ] The repo should have a short description of what it is for
- [ ] Add one of the following topic tags:
| Topic Tag | Usage |
| --------------- | ---------------------------------------- |
| az | For actions related to Azure |
| code | For actions related to building code |
| certs | For actions related to certificates |
| db | For actions related to databases |
| git | For actions related to Git |
| iis | For actions related to IIS |
| microsoft-teams | For actions related to Microsoft Teams |
| svc | For actions related to Windows Services |
| jira | For actions related to Jira |
| meta | For actions related to running workflows |
| pagerduty | For actions related to PagerDuty |
| test | For actions related to testing |
| tf | For actions related to Terraform |
- [ ] Add any additional topics for an action if they apply
- Address any remaining TODOs

## Inputs

| Parameter | Is Required | Description |
| --------- | ----------- | --------------------- |
| `input` | true | Description goes here |
| Parameter | Is Required | Default Value | Description |
| ----------------------- | ----------- | ------------------- | --------------------- |
| `name` | false | artifact | The Artifact Name |
| `path` | true | N/A, required value | A file, directory, or wildcard pattern that describes what to upload |
| `if-no-files-found` | false | warn | The action to take if no files are found at the path. Options are `warn`, `error`, or `info`. |
| `retention-days` | false | 15 | The number of days to retain the artifact before it expires. |


## Outputs

| Output | Description |
| -------- | --------------------- |
| `output` | Description goes here |
This workflow has zero outputs.

## Example

```yml
# TODO: Fill in the correct usage
jobs:
job1:
runs-on: ubuntu-20.04
runs-on: [self-hosted, im-linux]
steps:
- uses: actions/checkout@v3

- name: ''
uses: im-open/thisrepo@v1.0.0 # TODO: fix the action name
- name: 'Zip and Upload Artifact'
uses: im-open/zip-upload-artifact@v1.0.0
with:
input-1: ''
name: ${{ env.CODE_COVERAGE_REPORT_NAME }}
path: ${{ env.CODE_COVERAGE_DIR }}
```

## Contributing
Expand All @@ -107,7 +66,7 @@ This repo uses [git-version-lite] in its workflows to examine commit messages to

### Source Code Changes

The files and directories that are considered source code are listed in the `files-with-code` and `dirs-with-code` arguments in both the [build-and-review-pr] and [increment-version-on-merge] workflows.
The files and directories that are considered source code are listed in the `files-with-code` and `dirs-with-code` arguments in both the [build-and-review-pr] and [increment-version-on-merge] workflows.

If a PR contains source code changes, the README.md should be updated with the latest action version. The [build-and-review-pr] workflow will ensure these steps are performed when they are required. The workflow will provide instructions for completing these steps if the PR Author does not initially complete them.

Expand Down
45 changes: 33 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@
name: 'Composite Run Steps Action Template'
name: Zip & Upload Artifact

description: 'Add description here'
description: Zips Artifact and then Uploads it to GitHub

inputs:
input-1:
description: 'Add a description here'
# These are the same inputs as the Upload Artifact action.
# https://github.com/actions/upload-artifact
name:
description: The Artifact name
default: artifact
path:
description: A file, directory, or wildcard pattern that describes what to upload
required: true
if-no-files-found:
description: |
The action to take if no files are found at the path:

outputs:
output-1:
description: 'Add description here'
value: '${{ steps.step_1.outputs.world }}'
Options:
- warn: Warning sent, but build does not fail
- error: Error sent, and build fails
- info: Nothing sent, and build does not fail
default: warn
retention-days:
description: |
The number of days to retain the artifact before it expires. Value cannot be over 30 days
default: '15'

runs:
using: 'composite'
steps:
- name: Step 1
id: step_1
shell: bash
- name: Zip Artifact
shell: pwsh
run: |
echo "hello=world" >> $GITHUB_OUTPUT
echo "Zipping ${{ inputs.name }}"
Compress-Archive -Path ./${{ inputs.path }}/* -DestinationPath "./${{ inputs.path }}/${{ inputs.name }}.zip"

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name}}
path: ${{ inputs.path }}/${{ inputs.name }}.zip
if-no-files-found: ${{ inputs.if-no-files-found }}
retention-days: ${{ inputs.retention-days }}
Loading